Hi,
In my xamDataGrid, I have an unboundfield, when I select a row, all the bound fields are highlighted, but the unboundfield is not highlighted.
How can I configure the unboundfield so when a row is selected, the unboundfield also got highlighted ?
Thanks.
Hello yingwu,
Thank you for your post.
So far, I have not been able to reproduce this behavior you are currently seeing. The expected behavior of the XamDataGrid is that when a row is selected, the entirety of the row will appear highlighted. This leads me to believe that you may be applying some styles to your XamDataGrid. If so, would it be possible for you to list the elements that you are applying styles to? Some of the styles that may be of interest are styles that target the DataRecordPresenter, DataRecordCellArea, and CellValuePresenter. Are you applying any styles for either of these three elements?
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate DeveloperInfragistics Inc.www.infragistics.com/support
Hi Andrew,
Yes, I am applying a style that targets the CellValuePresenter of the unboundfield.
Here is the style:
<Style x:Key="ShowTitleStyle" TargetType="{x:Type igDP:CellValuePresenter}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}"> <Grid Background="{Binding}"> <TextBox x:Name="ShowTitleEn" Text="{Binding DataItem.ShowTitle}"/> <TextBox x:Name="ShowTitleFr" Text="{Binding DataItem.ShowTitleFr}"/> </Grid> <ControlTemplate.Triggers> <DataTrigger Binding="{Binding DataContext.Language, RelativeSource={RelativeSource AncestorType={x:Type igDP:XamDataGrid}}}" Value="fr"> <Setter TargetName="ShowTitleEn" Property="Visibility" Value="Collapsed" /> <Setter TargetName="ShowTitleFr" Property="Visibility" Value="Visible"/> </DataTrigger> <DataTrigger Binding="{Binding DataContext.Language, RelativeSource={RelativeSource AncestorType={x:Type igDP:XamDataGrid}}}" Value="en"> <Setter TargetName="ShowTitleEn" Property="Visibility" Value="Visible" /> <Setter TargetName="ShowTitleFr" Property="Visibility" Value="Collapsed"/> </DataTrigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style>
here is the unboundfield:
<igDP:UnboundField Label="ShowTitle" Width="Auto" > <igDP:UnboundField.Settings> <igDP:FieldSettings AllowEdit="False" AllowGroupBy="False" AllowResize="False" AllowSummaries="False" CellValuePresenterStyle="{StaticResource ShowTitleStyle}" LabelClickAction="Nothing" /> </igDP:UnboundField.Settings> </igDP:UnboundField>
How can I make this unboundfield appears highlighted when the row is selected?
Thank you.
The style that you have attached is writing a brand new template for the CellValuePresenter, and it may be discarding the part of the default template that is used in the highlighting of the cell. I would recommend that instead of writing a Template for the CellValuePresenter in this style, that you write a ContentTemplate. Be warned though, that this will effect the bindings that you have pointing to the CellValuePresenter's data context. You may need to replace these bindings with RelativeSource bindings to the CellValuePresenter and then use "DataContext.DataItem.PropertyName" for the path of that binding instead.
I also find it likely that the Grid's background being set to {Binding} may have a hand in this as well. That is binding directly to the data context of the CellValuePresenter that you are currently writing a template for, and this data context is not a Brush, but the DataRecord that the CellValuePresenter sits in. Is there a property that you are trying to bind the Grid's background to? If it exists on your data item, you may be able to use this binding path after implementing the ContentTemplate mentioned above: "DataContext.DataItem.BackgroundPropertyName."
I hope these suggestions help you. Please let me know if you have any other questions or concerns on this matter.