I see from the Infragistics documentation on a Record's FixedLocation that I can set a particular row's fixed location, but I can find a way to set this using a style. In a test project I tried the below, but it didn't work since the compiler won't let me set a property inside the Record object of the DataRecordPresenter. Error it gives me is:
"Cannot resolve the Style Property 'FixedLocation'. Verify that the owning type is the Style's TargetType, or use Class.Property syntax to specify the Property.
<Style TargetType="{x:Type DataPresenter:DataRecordPresenter}"> <Style.Triggers> <DataTrigger Binding="{Binding Path=DataItem.State}" Value="OR"> <Setter Property="Record.FixedLocation" Value="FixedToTop" /> </DataTrigger> </Style.Triggers></Style>
Hello,
FixedLocation is a property of the Record and not the DataRecordPresenter.
You could handle the initialize record event of the XamDataGrid and fix the record from there:
private void XamDataGrid_InitializeRecord(object sender, Infragistics.Windows.DataPresenter.Events.InitializeRecordEventArgs e)
{
if (e.Record is DataRecord)
if((e.Record as DataRecord).Cells[0].Value.ToString() == "or")
e.Record.DataPresenter.ExecuteCommand(DataPresenterCommands.FixRecordTop, e.Record);
}
Thanks for the suggestion, but as I mentioned in my post, I would like to do this in the XAML and the DataRecordPresenter does have an instance of the DataRecord and Record (not sure how they're different), but I can get to the FixedLocation property from there. Is there any way to set the Record.FixedLocation in the Xaml? I can do this using an attached property, but I'd rather do it directly if that's possible. If the DataRecordPresenter can't do it, is there something else which can?
To the best of my knowledge, you cannot set a nested property with a style setter (as in your case Record.FixedLocation). Thus I am not sure if this can be done completely in the xaml. The DataRecordPresenter is a visual representation of the DataRecord.