This question is locked. New answers and comments are not allowed.
I am using your DataTable construct to service a dynamic structure requirement, basically a pivot table with variable columns. This works well until the client want a visual cue when there are zero values.
I have 2 problems, the first is obvious, where do I assign the CellStyleSelector when using auto generate columns?
The second is how to get the value of the cell in the style selector code. When I inspect the container object there is a value property but there is no obvious way to get at the value.
I have 2 problems, the first is obvious, where do I assign the CellStyleSelector when using auto generate columns?
The second is how to get the value of the cell in the style selector code. When I inspect the container object there is a value property but there is no obvious way to get at the value.
public class ZeroStyleSelector : StyleSelector{ public override Style SelectStyle(object item, DependencyObject container) { Style oStyle = ZeroStyle; bool bOk; int iValue; object oValue = container.GetValue(); //<<<<<<<< this fails if (int.TryParse(oValue.ToString(), out iValue)) { if (iValue != 0) { oStyle = NonZeroStyle; } } return oStyle; } public Style ZeroStyle { get; set; } public Style NonZeroStyle { get; set; }}