Hi,
I would like to generally define my styles in the XAML, but add dynamic datatriggers on top in code-behind.
What I have in the xaml is like
<igDP:XamDataGrid.Resources>
<Style TargetType="{x:Type igDP:CellValuePresenter}">
<Setter Property="Background" Value="CadetBlue" />
</Style>
</igDP:XamDataGrid.Resources>
Somewhere in the code behind, I'd want to add, for example:
var dt = new DataTrigger
{
Binding = new Binding(bindingPath),
Value = true
};
dt.Setters.Add(new Setter(Control.BorderThicknessProperty, new Thickness(1)));
dt.Setters.Add(new Setter(Control.BorderBrushProperty, Brushes.Green));
Hello again,
It seems like I misunderstood you in some way. Now I attached the sample again and I believe it works as you want. The border changes its color, when the value of the XamCheckEditor changes. Please let me know if this is what you are trying to achieve or I have misunderstood you in some way.
Looking forward for your reply.
Hi Stefan,
I am not quite following, the basic issue is that, for a new record, it does not seem to update the style when you exit a cell, only when you exit the record.
In that case do not add a handler and the brush will be added, when the Editor exits edit mode. If I came up with a different approach I will update you.
Hope this helps you.
If I add the check handler to a text editor, every character i type will kick off endeditmode and starteditmode!
Is there a different approach to solving this?
Hello,
I can say that if you have XamComboEditor or XamTextEditor you just need to make the same Handlers as the one for the XamCheckEditor. If I have misunderstood your question in some way feel free to write me.