The objective is to change the label style on the cell selected which is in the corresponding column. Here's the code sample:
<Style TargetType="{x:Type igDP:LabelPresenter}">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=Field.IsSelected,RelativeSource={RelativeSource Self}}" Value="True">
<Setter Property="Background" Value="Red"></Setter>
<Setter Property="FontWeight" Value="Bold"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
However, when a cell is selected, the corresponding label in the column is not changed. Is there any way to achieve this? Thanks a lot
Hello,
I have been looking into your issue and the IsSelected property you have used is meant to indicate whether the whole Field is selected. You can see this in action, by setting the LabelClickAction property to SelectField as shown here: http://help.infragistics.com/Help/NetAdvantage/WPF/2011.2/CLR4.0/html/InfragisticsWPF4.DataPresenter.v11.2~Infragistics.Windows.DataPresenter.LabelClickAction.html
When it comes to knowing if a Cell is selected in the context of a Field, there is no property to indicate that, so there is no way to use a Trigger or a DataTrigger as in your code snippet. I did look into this and was able to figure out a way for you to achieve the desired functionality, by exploiting a MultiBinding directly from the XamDataGrid’s ActiveCell, to the highlighting properties. I have put all this into a sample project for you (Grid_hilghlight_selected_cell_header.zip)
Please let me know if I can assist you any further on the matter, or if I have misunderstood you in any way.
Hi,
I want to change Label background of selected cells. similar to Excel.(highlights column header and row selector of selected cells) can we achieve this in style or do I need to do in code behind.
Hello Ganesh,
I found this post duplicate to this one:
http://ko.infragistics.com/community/forums/p/82913/414387.aspx#414387
which is already discussed.