I am building a diagram based on the XamDiagram control, and I am building a custom version of the OptionsPane to modify properties on custom diagram items.
More specifically, I would like to add my own buttons for "Bring Forward/Backward" and "Bring to Front/Back," like the buttons that exist in the built-in OptionsPane. However, I have not found a clear way to execute those actions programmatically for a diagram item.
Is there a way to do this?
Alright, thanks!
Hello,
I created the following case for you: CAS-210761-Q2S7Q7 and will update you through it. You could see it in your account in the 'Support Activity' page.If you require any further assistance on the matter, please let me know.
Sincerely,Bozhidara PachilovaAssociate Software Developer
Followup:
From what I can tell, it looks like the built-in "Bring Forward/Backward" buttons simply increment/decrement the DiagramItem.ZIndex property, so I decided to try using the Zindex property to write the logic for simulating those actions.
However, now I'm running into a different problem. I am using two-way data binding with my own data to populate the XamDiagram, and I need to be able to set the ZIndex in my own data, which would then reflect back to the DiagramItem.ZIndex property, and vice versa.
So my data object looks similar to this:
class CustomDiagramItem: INotifyPropertyChanged{ public int ZIndex {get; set; } public string Text { get; set; } public Brush Fill { get; set; } // etc. }
I am then setting these custom objects in the Content property of the DiagramItem objects, as per the Xam Diagram documentation here: https://ko.infragistics.com/help/wpf/xamdiagram-binding-to-nodes-and-connections-data-with-references
So the data binding in my xaml looks something like this:
<ig:XamDiagram.NodeDefinitions> <ig:NodeDefinition TargetType="{x:Type local:CustomDiagramItem}" DisplayMemberPath="Text"> <ig:NodeDefinition.NodeStyle> <Style TargetType="ig:DiagramNode"> <Setter Property="Fill" Value="{Binding RelativeSource={RelativeSource Self}, Path=Content.Fill, Mode=TwoWay}" /> <Setter Property="ZIndex" Value="{Binding RelativeSource={RelativeSource Self}, Path=Content.ZIndex, Mode=TwoWay}" /> </Style> </ig:NodeDefinition.NodeStyle> </ig:NodeDefinition> </ig:XamDiagram.NodeDefinitions>
However, while my data binding has been working correctly, when I added the data binding for ZIndex, it didn't work. The ZIndex property updates in the DiagramItem when using the "Bring Forward/Backward" buttons, but its corresponding bound property in the CustomDiagramItem class does not update.