We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

PropertyGrid - setting column to Auto

Hi,

in the propertyGrid is there a way I can set the first column's
width to Auto?



image001_b5b21cc.rar

8 Replies

SS Sahaya Sweetlin Ponmalar P Syncfusion Team August 23, 2011 12:08 PM UTC

Hi Victor,

Thank you for using syncfusion products.

we have created a sample for making the first column as Auto Width in the Property Grid Control and you can download the sample under the following location.

Sample Link : http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=propertygrid_81538-1561342134.zip

In this sample, in App.xaml we define the Datatemplate "EditorTemplate" for displaying the property items in the Property Grid control. In this template we made the first column width as "Auto".

Please let me know if you have any queries.

Regards
Ponmalar




MK Michael Katsarakis December 12, 2018 09:11 AM UTC

Please upload the sample again!
I am trying to set the width of columns in PropertyGrid Control.


AA Arulraj A Syncfusion Team December 12, 2018 10:31 AM UTC

Hi Michael, 

Thanks for using Syncfusion products. 

You can download the sample for making the first column as Auto Width in the Property Grid Control from the following link, 

Please let us know if you have any further queries on this.  

Regards, 
Arulraj A 



MK Michael Katsarakis December 12, 2018 02:17 PM UTC

Hallo Arulraj,

i have testet it.
Instead of Auto i have give a certain value to the first column (111)

            <DataTemplate x:Key="EditorTemplate">
                <Border>
                    <Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch">                      
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="111"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>

Anyway... No data of selectedObject apears!!!

I can see the data if outcomment the region
            <Style  TargetType="local:PropertyViewItem" BasedOn="{StaticResource DefaultPropertyViewItemStyle}">
but then the columns ratio is equal to 50/50  :-(

Greetings
Michael




AA Arulraj A Syncfusion Team December 13, 2018 12:12 PM UTC

Hi Michael, 

We regret for the inconvenience caused. 

We have now modified the sample by including content to the content presenter of the “DefaultPropertyViewItemStyle” to display the SelectedObject with required width and it can be downloaded from the following location. Please check with sample and let us know your issue has been resolved. 

Please let us know if you need further assistance on this. 

Arulraj A 



MK Michael Katsarakis December 13, 2018 12:30 PM UTC

Thank you!
Now it works!!!


BP bernhard pollerspöck December 26, 2019 08:26 AM UTC

i changed my propertygrid visual style to "Transparent" 

i also changed the merged dictionary like:
<ResourceDictionary Source="/Syncfusion.PropertyGrid.Wpf;component/Themes/TransparentStyle.xaml" />

and changed the based on style like:
<Style BasedOn="{StaticResource TransparentPropertyViewItemStyle}" TargetType="local:PropertyViewItem">

but the editor doesnt get applied. is there something i missed by changing the style?




UN Unknown Syncfusion Team December 30, 2019 06:45 AM UTC

Hi Bernhard, 

Thanks for contacting Synfusion support. 

We have checked your query ”Editor style is not set when use the transparent theme”. In your style for PropertyViewItem , assign EditorTemplate value to ContentTemplate property of ContentPresenter. Can you please provide us details regarding how you have set your Editor style? We have attached a simple sample and screenshot below to meet your criteria and refer the below code snippet for the same. Please let us know if you have any queries. 

C#: 
<Style  TargetType="local:PropertyViewItem" BasedOn="{StaticResource TransparentPropertyViewItemStyle}"> 
                <Setter Property="Template"> 
                    <Setter.Value> 
                        <ControlTemplate TargetType="local:PropertyViewItem"> 
                            <Border x:Name="Bd" Background="{TemplateBinding Background}" 
                            BorderBrush="{TemplateBinding BorderBrush}" 
                            BorderThickness="{TemplateBinding BorderThickness}"  MinHeight="27"> 
                                <ContentPresenter ContentTemplate="{StaticResource EditorTemplate}" Content="{TemplateBinding HeaderedItemsControl.Header}" /> 
                            </Border> 
                        </ControlTemplate> 
                    </Setter.Value> 
                </Setter> 
            </Style> 


 
Screenshot: 
 
Regards, 
Niranjan Kumar Gopalan 
 


Loader.
Live Chat Icon For mobile
Up arrow icon