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
50
ToggleButton only shown at one node of XamDatatree
posted

Hello,
I'm using XamDataTree. The tree to display has nodes of several types. Every node can have subnodes of more than one type. That's why all node type view models are derived from the same base node view model and have different layouts. The "C" node type has a ToggleButton in his layout with different icons on it depending on the IsChecked state.
The problem is that the button is only displayed on one node, although multiple Type C nodes exist. How can I solve this problem? To show the situation I append a simple example.

Thanks in advance.

1856.DataTreeNodeLayoutBasedOnClass.zip

Parents
  • 33370
    Verified Answer
    Offline posted

    Hello Josch,

    I have been investigating into the sample project you have provided, and after using a third-party WPF visual tree inspection tool named Snoop, I can see that the image that you are trying to place in the tree node is there, it just has a Width of zero. Furthermore, if I set the “IsChecked” property through this tool, I can get the image to jump around. It seems like something about setting the Content to be this image is not allowing the image to be shared.

    I have worked around this by setting the ContentTemplate on the ToggleButton instead of the Content and then adding a ContentControl with the images as its content. I am unsure why setting the Content directly doesn’t work, but I was able to reproduce this not working with built-in Microsoft controls, so I believe this might just be a weird WPF thing more than an issue with the XamDataTree specifically.

    I am attaching a modified version of your sample project to demonstrate the above. I hope this helps you.

    Please let me know if you have any other questions or concerns on this matter.

    2112.1856.DataTreeNodeLayoutBasedOnClass.zip

Reply Children
No Data