Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
Change Node Color schema based on a class value

Hi, I'm making some tests to see if I can use the XamTreeMap for one of my projects.

From what I've seen in the samples and the documentation, I have the possibility to ask the

control to change the color of a tile inside the tree based on the value displayed and this is a nice thing.

I've also seen that I can decide the color schema of the nodes for each node type (class) used.

Unfortunately I haven't found if there is a way to decide which color schema a tile have to use based on a property of said class.

I try to explain better.

I have a Class, named Company that is the first level node, the class have a value (Total) that is used as ValuePath in the node binder.

Company has an ItemsSourcePath (Amounts) that is a collection of Amount classes. Each amount class has a Node Binder that uses a field (Total) as valuepath.

The ValueMappers allow me to decide a color mapper for the Company class and a Color Mapper for the Amount class and this can be useful in some cases.

Unfortunately, my Amount classes are some of Type "INCOME" and some of type "OUTCOME" and it would be nice to paint the Income tiles in shades of Green based on the Total value and paint the Outcome tiles in shades of red/yellow based on the Total Value of the same.

After all this writing the question is:

can I set a different color schema for the tiles of a certain class based on the value assumed by a property in said class?

I hope I've been clear.


  • 34510
    Offline posted

    Hi Sabrina,

    Can you clarify about your INCOME and OUTCOME types?  Does your Amount class contain a Type property with either INCOME or OUTCOME set?  Or is there a new class named INCOME that derives from Amount?  If you have a new class called INCOME then you should be able to color the tiles differently based on the class type.  Take a look at my attached sample.

    If your INCOME and OUTCOME types are defined as a property inside the Amount class then the ColorMapper feature isn't going to help.  It cannot perform conditional coloring based on a particular type property that isn't the ValuePath.  For this a custom mapper might be a better option.
Reply Children