I am using a xamdatagrid. Inside my xaml I am grouping based on a field called ServerName. Now the records are collapsed when the application loads up. I have tried applying the trigger on the IsExpanded property but it doesn't work.
Here's a screen shot:
I also want to hide the ServeName column so that the users can't remove it from the grouping.
Any help would be really appreciated.
Thanks...
The correct way of expanding a Record is through the Record's IsExpanded property rather than the DataRecordPresenter's IsExpanded property. You can do this in the InitializeRecord and check if e.Record is GroupByRecord and expand it or you can do this in the XamDataGrid's Loaded event. You will not be able to do this correctly using Triggers.
Regarding the Grouping, if you want the user not to ungroup by this field, you can hide the GroupByAreaFieldLabel for the particular field by creating a style and setting the visibility property like this:
<Style TargetType="{x:Type igDP:GroupByAreaFieldLabel}">
<Style.Triggers>
<DataTrigger Binding="{Binding Field.Name}" Value="LastName">
<Setter Property="Visibility" Value="Collapsed"/>
</DataTrigger>
</Style.Triggers>
</Style>
I figured out the first part of my question. I needed to get hold of the initializerecord event and forced the isExpanded property to true in code behind.
Can I achieve the same result from Event Triggers?