17 Answers, 1 is accepted
In order to achieve your goal, you can handle RadPropertyGrid's Loaded event and execute the following code:
this.Dispatcher.BeginInvoke(new Action(() => { (sender as RadPropertyGrid).ChildrenOfType<
RadToggleButton
>().FirstOrDefault(b => b.Name == "PART_NestedPropertiesButton").IsChecked = true; }));
I believe that is what you are looking for.
All the best,
Yoan
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
Thanks.
You can try setting the IsExpanded property of PropertyDefinition on the occurrence of AutoGeneratingPropertyDefinition event. It is a relatively new property, which was introduced with Q2 2013.
Regards,Ivan Ivanov
Telerik
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
I have a property grid, and it has NestedPropertiesVisibility="Visible". I want to have all the children expanded by default, and for this i have edited the grid's template, and changed the flatTemplate like this:
<DataTemplate x:Key="flatTemplate">
<ItemsControl ItemsSource="{Binding Converter={StaticResource FlatItemSourceConverter}}" Style="{StaticResource ItemsControlStyle}" IsTabStop="False">
<ItemsControl.ItemTemplate>
<DataTemplate>
<telerik:PropertyGridField IsExpanded="True" Content="{Binding}" telerik:StyleManager.Theme="{StaticResource Theme}" Visibility="{Binding Visibility}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
I have added the isExpanded property to true. However, the whole application crushes, and the only difference is the IsExpanded property.
I have the sample project, but cannot upload it in this post. How can I do this?
Can you help please?
Regards,
Alex
Indeed, it is just allowed to add screenshots with the forum posts. You can open a new support thread and attach the sample solution there.
Regards,
Dimitrina
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
I get:
"Your license has expired or does not include dedicated support. Please visit Renewals and Upgrades or contact your license holder."
Anyway, I have renamed the archive as jpg, can you change please the extension back to zip, and extract tha project?
Regards,
Alex
I didn't attach the telerik libraries, but i'm using v2014.3.1202.40
Thank you for providing a sample project. I was indeed able to reproduce the issue.
Is the change you refer to the only change you made when editing the template:
<
DataTemplate
x:Key
=
"flatTemplate"
>
<
ItemsControl
ItemsSource
=
"{Binding Converter={StaticResource FlatItemSourceConverter}}"
Style
=
"{StaticResource ItemsControlStyle}"
IsTabStop
=
"False"
>
<
ItemsControl.ItemTemplate
>
<
DataTemplate
>
<
telerik:PropertyGridField
IsExpanded
=
"True"
Content
=
"{Binding}"
telerik:StyleManager.Theme
=
"{StaticResource Theme}"
Visibility
=
"{Binding Visibility}"
/>
</
DataTemplate
>
</
ItemsControl.ItemTemplate
>
</
ItemsControl
>
</
DataTemplate
>
As it turns out once I commented the template of RadPropertyGrid as you have redefined it and I subscribed for the AutoGeneratingPropertyDefinition, setting the IsExpanded property of PropertyDefinition, it worked fine. Is it an option for you to use this approach instead?
Regards,
Dimitrina
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
Thanks for your answer. I also used this approach, unsuccesfully.
The property grid I am having issues with contains collection editors, which I have also redefined to be able to costomize them. They also contain property grids, nested. I was able to use the event you mentioned to trigger a command instead, on all property grids, and the expand was working relatively fine, however:
- the grids flicker 3-4 seconds when expanding all properties, on all levels
- if the object binded to the primary grid is very complex (if it has a lot of children with lists of children with lists of children), these expansions will result in a strage exception, similar to the one mentioned above
I was hoping to be able to have all properties expanded by default. And I don't understand why setting this property, IsExpanded, to true, has such a strange behaviour.
I also redefined the PropertyGridField, based on telerik xaml source code, until I reached the '+' toggle button, to eliminate any Visual effects, but still was not able to sort this out
Thanks,
Alex
As it turns out we can currently suggest using the approach with expanding the PropertyDefinitions when the AutoGeneratingPropertyDefinition event is raised.
Regards,
Dimitrina
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
Ok, but is the only solution? If yes I'm dissapointed because as I mentioned before, this doesn't work well on complex objects. I can provide an example if you require
Regards,
Alex
Ok, but is this the only solution? If yes, I'm dissapointed, because as I've mentioned above, this doesn't work well on more complex objects. I can provide a sample if you require
Regards,
Alex
I am afraid we cannot suggest another way to achieve your goal. Please excuse us for the inconvenience.
Regards,
Dimitrina
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
Ok, I understand, but please tell me if in future versions of the PropertyGrid Control will this be fixed or will remain the same
Regards,
Alex
I can also suggest you one alternative solution subscribing for the Loaded event of RadPropertyGrid.
For example:
private void grdPropr_Loaded(object sender, RoutedEventArgs e)
{
grdPropr.PropertyDefinitions.SuspendNotifications();
foreach (var item in grdPropr.PropertyDefinitions)
{
item.IsExpanded = true;
}
grdPropr.PropertyDefinitions.ResumeNotifications();
}
Please note you should additionally configure the control with:
RenderMode="Flat"as this is only supported in Flat mode.
Upon your request, I logged the suggestion as a Feature Request in our public Feedback Portal. You can vote for it and also follow its progress here:
Allow expanding nested properties at startup.
Regards,
Dimitrina
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
Thank you for your response, I managed to solve the problem by using RenderMode="Flat". This helps solving the exceptions which occured before.
Regards,
Alex