<Style x:Key="alternatingRowStyle" TargetType="syxg:VirtualizingCellsControl"> <Setter Property="Background" > <Setter.Value> <SolidColorBrush Color="{Binding Path=Color, ElementName=alternatingRowBackgroundPicker}" /> </Setter.Value> </Setter> </Style>
public MyWindowModel Model { get { return mModel; } private set { mModel = value; } }
public MyWindow() { InitializeComponent();
Model = new MyWindowModel(); this.DataContext = Model; }
<Style x:Key="alternatingRowStyle" TargetType="Syncfusion:VirtualizingCellsControl"> <Setter Property="Background"> <Setter.Value> <SolidColorBrush Color="{Binding Path=DataContext.ColorPickerColor, UpdateSourceTrigger=PropertyChanged, RelativeSource={RelativeSource AncestorType=Window, Mode=FindAncestor}}" /> </Setter.Value> </Setter> class ViewModel : INotifyPropertyChanged { #region Constructor public ViewModel() { Employees = PopulateCollection(); ColorPickerColor = Colors.Green; private Color colorPickerColor;
public Color ColorPickerColor
{ get { return colorPickerColor; } set { colorPickerColor = value; OnPropertyChanged("ColorPickerColor"); } |