Hi to all,
I would to change a CellStyle based to more specific properties of Currenti Item.
Example:
ItemA.Property1
ItemA.Property2
ItemA.Property3
ItemB.Property1
ItemB.Property2
ItemB.Property3
ItemA and ItemB derives from ItemBase that it has CanProperty1, CanProperty2 and CanProperty3 (all 3 boolean)
Now, I would change style to show cell content's only if CanPropertyX = true, if no it will shows other cellstyle (empty cell)
Actually I'm using StyleSelector pattern, but it receives all currenti item, it doesn't know witch property it refer.
How can I do this?
01.public class MyItemStyle : StyleSelector02.{03. public override Style SelectStyle(object item, DependencyObject container)04. {05. if (item is MyItem)06. {07. MyItem currentItem = item as MyItem;08. 09. //Can I receive a specific property on to test?10. //Can I receive a parameter (like Command) ?11. 12. if (currentItem.MyProperty1)13. return MyFirstItemStyle;14. else15. return MySecondItemStyle;16. }17. return null;18. }19. public Style MyFirstItemStyle { get; set; }20. public Style MySecondItemStyle { get; set; }21.}