This project has moved. For the latest updates, please go here.

PropertyGrid : Aligning property name labels to the left in xaml

Oct 17, 2014 at 9:22 AM
Hi,

On the left column of the propertyGrid, the text is centered and I want aligning it to the left, is this possible ?
I use the install by Nuget so I can't access directly to the code for probably change default values.
I was looking for something like that :
<Style TargetType="{x:Type xctk:PropertyGridEditorTextBox}">
              <Setter Property="TextAlignment" Value="Left" />                           
</Style>
But I haven't found what was the name for the propertyName label.

Thanks a lot for your answer if you have it.
Developer
Oct 17, 2014 at 12:37 PM
Hi,

The PropertyNames in the PropertyGrid are not centered. They are Stretched. But on the left of them, there is a 15 pixels margin for an expandable button (when necessary). Then, the PropertyName is displayed (right after those 15 pixel). You can see the image here : http://postimg.org/image/m0qr23mnb/ taken from the LiveExplorer App ; available herre : https://wpftoolkit.codeplex.com/. When resizing the PropertyValues column size to be smaller, you can see that the PropertyNames are not centered.
Oct 17, 2014 at 1:31 PM
I understand, but I'm really centered by default as you can see on that picture, even category titles are centered : http://postimg.org/image/bg1sepcop/

Finally I've aligned to left all the PropertyGrid to become like on your picture. Tell me if there is a better solution.
My difficulty was I wanted to align to the left only the PropertyName column, now it's easier.
<xctk:PropertyGrid Name="PropertyGridEquipement" ShowTitle="False" ShowSummary="False"
                                    UpdateTextBoxSourceOnEnterKey="True" TextBlock.TextAlignment="Left">
Thanks for your answer and for the propertyGrid in general, it's very impressive and functionnal !
Marked as answer by clemmercier on 10/17/2014 at 6:53 AM