Determine Group Children in Style


I am trying to work out if there are children nodes in a group from within the style so I can use triggers to modify the template of the group.




<go:GroupPanel x:Name=“myGroupPanel” Padding=“5” />




I can’t work out however what property I should be accessing to determine if there are children.

If anyone can point me in the right direction I would be greatful



A GroupPanel is just a visual element whose bounds may be the collective bounds of its member Nodes. The Group.MemberNodes property is what you were probably trying to use.

But you really ought to look at the data object to which the Group is bound.

So instead of using a Trigger, you want to do something like:
<Border … Visibility={Binding Path=Data.MemberKeys.Count,
Converter={StaticResource theCountVisibilityConverter}}">
<go:GroupPanel x:Name=“myGroupPanel” Padding=“5” />

That uses this resource:
<go:CountVisibilityConverter x:Key=“theCountVisibilityConverter” />

A number of samples in the GoWpfDemo do this or something like it.

If you want to dynamically change the group member keys such that you want the visibility to change, it might be easiest to define a new property on your group data class that calls RaisePropertyChanged when you change its value, and then data-bind to that property instead of to ObservableCollection.Count.