Is there a way to raise PropertyChanged when IsGroupBy changes on a FieldLayout? I have some labels whose Visibilities I want to bind to IsGroupBy using a DataTrigger. The initial rendering works fine, however, when the user groups/degroups on the XamDataGrid, the DataTrigger is not reevaluated because no PropertyChanged was raised.
Definition of DataTrigger mentioned:
<DataTrigger Binding="{Binding IsGroupBy, ElementName=itemType, Mode=TwoWay}" Value="True">
<Setter Property="Label.Visibility" Value="Collapsed" />
</DataTrigger>
Definition of "itemType":
<igDP:FieldSortDescription x:Name="itemType" IsGroupBy="True" Direction="Ascending" FieldName="Item_Type"/>
Thanks!
Hello Daniel,
Thank you for your post. I have been looking into it and I created a sample project for you with the functionality you want. Basically I created Style for the LabelPresenter and bound its Visibility to the IsGroupByProeprty and using converter I set this Property. Please let me know if his helps you or you need further assistance on this matter.
Looking forward for your reply.
Stefan, this works great for what I asked! On a slightly different note, I need to set my label's visibility based on more than one condition. The first condition being the IsGroupBy property, the second condition being a property on the ViewModel.
To achieve the desired effect, I've done the following:
<Label.Style>
<Style>
<Style.Triggers>
<DataTrigger Binding="{Binding ViewModelProperty}" Value="True" >
<Setter Property="Label.Visibility" Value="{Binding ElementName=itemType, Path=Field.IsGroupBy,
Converter={StaticResource boolToVisibilityConverter}}" />
<DataTrigger Binding="{Binding Trigger}" Value="False" >
</Style.Triggers>
</Style>
</Label.Style>
For some context, I want to display a "dummy" label when the user groups by a column (that inherently will contain up to 4 different values) and one of those 4 values isn't listed in the data, so the subgrouping would never appear. So, I always want to show the user the number of items for each value, even if the number of items is 0.
Column1 Column2 Column3
Potential values for Column1: Red, Green, Yellow
Group by Column1....
User sees the subheadings of:"Red (2 items)"
"Green (5 items)"
"Yellow (0 items)"
I believe this is outside the context of my original question, so will mark it answered. If there is an easier way than show/hide dummy label based on # of items > 0 && IsGroupBy Column1 = true, then let me know :). Thanks.