Hello,
I want PropertyGrid to collapse arbitrary groups into it after control is loaded. I read several forums posts, but neither of suggested solutions work well. Actually, I wrote behavior and it did I what I want, but after migrating on new Telerik controls version 2013.3 it cease work properly.
I've attached link on test project.
Do you have any ideas how to enforce PropertyGrid collapse group properly?
I want PropertyGrid to collapse arbitrary groups into it after control is loaded. I read several forums posts, but neither of suggested solutions work well. Actually, I wrote behavior and it did I what I want, but after migrating on new Telerik controls version 2013.3 it cease work properly.
I've attached link on test project.
Do you have any ideas how to enforce PropertyGrid collapse group properly?
8 Answers, 1 is accepted
0
Hi Denis,
You can work with the methods of property grid:
1. ExpandGroup(key), CollapseGroup(key)
2. ExpandAll()/CollapseAll()
We will also update our documentation so that it describes their usage.
Regards,
Maya
Telerik
You can work with the methods of property grid:
1. ExpandGroup(key), CollapseGroup(key)
2. ExpandAll()/CollapseAll()
We will also update our documentation so that it describes their usage.
Regards,
Maya
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
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 >>
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 >>
0
Denis
Top achievements
Rank 1
answered on 19 Dec 2013, 08:40 AM
Hello Maya,
As you can see from attached project, I used this method CollapseGroup(), but it simply doesn't collapse group, when PropertyGrid control is loaded. Can you reproduce this incorrect behavior in my project?
As you can see from attached project, I used this method CollapseGroup(), but it simply doesn't collapse group, when PropertyGrid control is loaded. Can you reproduce this incorrect behavior in my project?
0
Accepted
Hi Denis,
The thing is that groups are not yet created on Loaded event and GroupDefinitions collection is still empty.
What you can try is to invoke the method a bit later. For example:
Regards,
Maya
Telerik
The thing is that groups are not yet created on Loaded event and GroupDefinitions collection is still empty.
What you can try is to invoke the method a bit later. For example:
void AssociatedObject_Loaded(object sender, RoutedEventArgs e)
{
Dispatcher.BeginInvoke(new Action(()=>
AssociatedObject.CollapseGroup(GroupName)));
}
Regards,
Maya
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
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 >>
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 >>
0
Denis
Top achievements
Rank 1
answered on 19 Dec 2013, 11:28 AM
Hi Maya,
Thanks a lot!
This code you suggested works fine with my test project, but doesn't work in my real application. I found out, that it is character properties of Dispatcher working. This is solution that works for my purposes below. May be it will be helpful for someone else.
Thanks a lot!
This code you suggested works fine with my test project, but doesn't work in my real application. I found out, that it is character properties of Dispatcher working. This is solution that works for my purposes below. May be it will be helpful for someone else.
public
class
RadPropertyGridCollapseGroupBehavior : Behavior<RadPropertyGrid>
{
protected
override
void
OnAttached()
{
base
.OnAttached();
AssociatedObject.Loaded += AssociatedObject_Loaded;
}
protected
override
void
OnDetaching()
{
AssociatedObject.Loaded -= AssociatedObject_Loaded;
base
.OnDetaching();
}
public
string
GroupName {
get
;
set
; }
private
void
AssociatedObject_Loaded(
object
sender, RoutedEventArgs args)
{
// use DataBind priority to enforce Dispatcher invoke method in appropriate time
Dispatcher.BeginInvoke(DispatcherPriority.DataBind,
new
Action(() => AssociatedObject.CollapseGroup(GroupName)));
}
}
0
Dharmavaram
Top achievements
Rank 1
answered on 24 Oct 2016, 10:33 AM
Hi,
I have a propertyGrid and I want to collapse all the groups. I tried dispatcher in the loaded event and it is working fine.But Here I have a tree view when the selected Item of the tree changes Property Grid updates.So I tried in Item changed event the same code suggested by Maya but it is not working.We have to write behavior as suggested and call appropriately or any other solution??
Regards,
Nagasree.
0
Hello Nagasree,
You can try to use PropertyGrid's ItemChanged event. Then you can execute the code for collapsing the group using a Dispatcher with Background priority. This is needed because the groups are not yet created on ItemChanged event and GroupDefinitions collection is still empty. This is why you need to invoke the method a bit later using the DispatcherPriority.
I hope this helps.
Regards,
Yoan
Telerik by Progress
You can try to use PropertyGrid's ItemChanged event. Then you can execute the code for collapsing the group using a Dispatcher with Background priority. This is needed because the groups are not yet created on ItemChanged event and GroupDefinitions collection is still empty. This is why you need to invoke the method a bit later using the DispatcherPriority.
I hope this helps.
Regards,
Yoan
Telerik by Progress
Do you need help with upgrading your WPF project? Try the Telerik API Analyzer and share your thoughts!
0
Dharmavaram
Top achievements
Rank 1
answered on 27 Oct 2016, 08:16 AM
Hi Yoan,
I have tried using dispatcher in Itemchanged event of RadPropertyGrid. It is not working as expected.Can you please check once and confirm?
Regards,
Nagasree
0
Hi Nagasree,
It is working at my end. Please check the attached sample project for a reference.
Regards,
Yoan
Telerik by Progress
It is working at my end. Please check the attached sample project for a reference.
Regards,
Yoan
Telerik by Progress
Do you need help with upgrading your WPF project? Try the Telerik API Analyzer and share your thoughts!