Hi
I'm having trouble trying to modify the Selected Background color on the WPF Grid. I've followed the examples and still having no luck.I've attached a sample which "should" change the default selected row color, but it doesn't...
Any help would be most appreciated.
Thanks
M
<
Window x:Class
="GridSelectedItem.Window1"
="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
="http://schemas.microsoft.com/winfx/2006/xaml"
="clr-namespace:GridSelectedItem">
>
="True">
="True" />
="SelectRecord" />
}">
="BackgroundSelected">
="0,1">
="Violet"/>
="Red"/>
</
Thanks for your help.. works for me. Might affect performance a lil bit.
Hello Vijay,
Hello I have been looking into your request and since you cannot do this via the built-in functionality I can suggest you create a style for your CellValuepresetners containing an EventSetter to handle the Cell clicing as well. Here is sampl xaml snippet you can try out:
<Style TargetType="{x:Type my:CellValuePresenter}">
<EventSetter Event="MouseLeftButtonDown" Handler="CellValuePresenter_MouseLeftButtonDown" />
</Style>
and the code to go with it:
void CellValuePresenter_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
// (sender as CellValuePresenter)...
}
Hope this helps. Please let me know if you require any further assistance on the matter.
Sincerely,
Petar Monov
Developer Support Engineer
Infragistics Bulgaria
www.infragistics.com/support
Is it possible to have CellClickAction set to SelectRecord and also have the CellActivating event fired. I have a requirement wherein if the user selects any cell the record should get selected and also if the user selects a particular cell, I have to change the foreground color of that cell.
Thanks, VJ
Works perfectly... Thanks loads.!!
You have to change the style to target the DataRecordCellArea instead of the CellValuePresenter since you are setting CellClickAction to SelectRecord. The following style should works correctly:
<Style TargetType="{x:Type my:DataRecordCellArea }"> <Setter Property ="BackgroundSelected"> <Setter.Value> <LinearGradientBrush StartPoint="0,0" EndPoint ="0,1"> <GradientStop Offset="0" Color ="Violet"/> <GradientStop Offset="1.1" Color ="Red"/> </LinearGradientBrush> </Setter.Value> </Setter></Style>
Regards
Vlad