The problem statement.
I'm using XamDataGrid to display matrix (3x3 for instance) and each cell contains not the simple datatype like String or Int32 but my own complex type DataCell.
DataCell object contains 3 fields -> LocalValue, ServerValue and State.
LocalValue is editable by user, ServerValue is readonly and State could be one of three: Normal, Pending and Error.
My goal to display LocalValue in XamDataGrid and highlight Cell background color depending on the State value.
Could you please advise how is it better to achieve that?
I'm looking at CellValuePresenter style but don't find working solution yet, probably it's a wrong way.
HI,
Here a link on how to represent a complex Properityhttp://help.infragistics.com/NetAdvantage/WPF/2010.3/CLR4.0/?page=xamDataPresenter_Displaying_a_Complex_Property.html
Here is a link on how to conditionally format records based on a value in a specified field. http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=10107
Sincerely, Matt Developer Support Engineer
Hi Matt,
Thanks for the links.
Here is my final result.
1. I've created set of unbound fields
2. I define a converter from my.custom.Value type to double.
Basically these steps allow me to have my custom objects in the grid and display them as doubles.
The last trick is to provide animation on state changed of my custom object.
To do so I defined a custom style for CellValuePresenter.
<Style x:Key="tst" TargetType="i:CellValuePresenter">
<Setter Property="Tag" Value="{Binding RelativeSource={RelativeSource Self}, Converter={StaticResource co}}" />
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Tag.IsPending}" Value="True">
<Setter Property="Background" Value="Yellow" />
</DataTrigger>
</Style.Triggers>
</Style>
The CellValuePresenter does have a value property.
Here is a help link to the CellValuePresenter API http://help.infragistics.com/NetAdvantage/WPF/2010.3/CLR4.0/?page=InfragisticsWPF4.DataPresenter.v10.3~Infragistics.Windows.DataPresenter.CellValuePresenter_members.html
As far as highlighting code, you could copy from a word document.Sincerely, Matt Developer Support Engineer
Hi birdjess,
would you share the solution which worked better for you?
thanks you.
No thank you.
I found a bit different solution, which works better in my case.
Thank you, for quick responses.
I am just following up on this forum post.
Please let me khow if you need further assistance.
Sincerely,
Matt Developer Support Engineer