I have an xceed WPF Datagrid that I want to color a particular cell in each row a particular way.
The grid is bound to a Collection of Bid objects. The column I want to apply to color is BidValue.
<xcdg:DataGridCollectionViewSource x:Key="BidViewSource" Source="{Binding Bids}"
d:DesignSource="{d:DesignInstance {x:Type models:Bid}, CreateList=True}">...
<xcdg:DataGridControl Name="BidGrid" DockPanel.Dock="Bottom" VerticalAlignment="Top" AutoCreateColumns="False"
ReadOnly="True" ItemsSource="{Binding Source={StaticResource BidViewSource}}"...
In order to simply the process, Bid.BackgroundColor and Bid.ForegroundColor exist for the purpose of supplying getters that determine the correct Color that BidValue should be displayed in.
Basically what I'm trying to do should begin something like this:
<xcdg:Column FieldName="BidValue" Title="Bid" CellHorizontalContentAlignment="Center" MaxWidth="75" AllowSort="False">
<xcdg:Column.CellContentTemplate>
<DataTemplate>
<DataTemplate.Triggers>
The remaining part that connects it to my the color fields in the Bid object is proving difficult. I've tried to implement the coloring logic in XAML (which is more common) with something like this:
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding Path=BidValue}" Value="X" >
<Setter Property="Background" Value="Red"/>
<Setter Property="Foreground" Value="White"/>
</DataTrigger>
but when I do I get the following:
error MC4109: Cannot find the Template Property 'Background' on the type 'System.Windows.Controls.ContentPresenter