Is there any way I can display the text in a particular cell with Bold text based on the value of another cell in the same row ? I.e I have a IsDefault cell and if this is set tro 1 I would like another cell to be displayed with different formatting.
Many Thanks
Niclas
As this is a style, you just have to add it in the Resource dictionary of the XamDataGrid. You can do this in any event - for example - in the FieldLayoutInitialized, when the FieldLayout is created (right after you bind the XamDataGrid) or in the Loaded event of the XamDataGrid.
Thanks,
Assume I should run this at the time of binding of the Grid, but having looked at the events available there does not seem to be an event for this. Where should I execute this code ?
Thanks for your help
Niclas,
This should be the c# equivallent:
Style s = new Style(typeof(CellValuePresenter));
DataTrigger trigger = new DataTrigger();
Binding binding = new Binding("Cells[IsDefault].Value");
trigger.Value = "1";
trigger.Binding = binding;
Setter setter = new Setter(CellValuePresenter.FontWeightProperty, FontWeights.Bold);
trigger.Setters.Add(setter);
Could this be done in code behind (which im for familiar with than XAML)
Thanks
Hello Niclas,
Yes, it is possible. You should create a style for the CellValuePresenter and use DataTrigger for the Value property of the cell that you want to access. You should set the Path to Cells[namecell"].Value and then use a Setter for the FontWeight property.
Please let me know if you need further assistance with this. It should look something like this:
<Style TargetType="{x:Type igDP:CellValuePresenter}">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=Cells[IsDefault].Value}" Value="1">
<Setter Property="FontWeight" Value="Bold"/>
</DataTrigger>
</Style.Triggers>
</Style>