This is a bit odd, as I would expect binding changes would be respected. I'm not sure if it is a bug or not, but its definitely unexpected.
ZIndex is a DependencyProperty of the RadDiagramItem class. Being read/write, I would expect that changes to the ZOrder would be reflected in the RadDiagram. This is not the case.
If this is recognized as a bug, I have a repro project I can send along.
Given a type ModelItem with the following DependencyProperties: Position, Width, Height, Color, and ZIndex (I'll omit that code as it is lengthy).
I have a custom graph which implements IGraphSource<ModelItem>, IObservableGraphSource (again, omitted for space) which I add three items to, which match the example found here.
In the UI, I have a style which binds the relevant properties of each ModelItem to a RadDiagramShape.
Note that the shape's NormalContent displays the ZIndex.
Finally, I have a RadNumericUpDown that controls the ZIndex of the SelectedItem in the RadDiagram
I'll attach a screenshot that shows that, even though the ZIndex has changed, the order of shapes on the diagram has not. In the screenshot, you can see that everything appears as it should be -- the ZIndexes of my models are correctly reflected in bindings of the RadDiagramShape, selection bindings work, and changes in the RadNumericUpDown are reflected in the bindings.
However, changes to RadDiagramItem.ZIndex are completely ignored by the RadDiagram, both when initially added, and forever thereafter. What's the point of the ZIndex property when it doesn't work?
If bug, you are hereby notified. If not, you need this feature request. Either way, I could use some help with a workaround.
ZIndex is a DependencyProperty of the RadDiagramItem class. Being read/write, I would expect that changes to the ZOrder would be reflected in the RadDiagram. This is not the case.
If this is recognized as a bug, I have a repro project I can send along.
Given a type ModelItem with the following DependencyProperties: Position, Width, Height, Color, and ZIndex (I'll omit that code as it is lengthy).
I have a custom graph which implements IGraphSource<ModelItem>, IObservableGraphSource (again, omitted for space) which I add three items to, which match the example found here.
public
MainWindow()
{
InitializeComponent();
var graph =
new
TemplateGraph();
graph.AddNode(
new
ModelItem
{
ZIndex = 3,
Position =
new
Point(80, 120),
Width = 150,
Height = 150,
Color = Colors.Red
});
graph.AddNode(
new
ModelItem
{
ZIndex = 2,
Position =
new
Point(180, 120),
Width = 150,
Height = 150,
Color = Colors.Green
});
graph.AddNode(
new
ModelItem
{
ZIndex = 1,
Position =
new
Point(120, 20),
Width = 150,
Height = 150,
Color = Colors.Blue
});
diagram.GraphSource = graph;
}
In the UI, I have a style which binds the relevant properties of each ModelItem to a RadDiagramShape.
<
Window.Resources
>
<
Style
TargetType
=
"telerik:RadDiagramShape"
>
<
Setter
Property
=
"Position"
Value
=
"{Binding Position}"
/>
<
Setter
Property
=
"IsConnectorsManipulationEnabled"
Value
=
"False"
/>
<
Setter
Property
=
"Background"
>
<
Setter.Value
>
<
SolidColorBrush
Color
=
"{Binding Color}"
/>
</
Setter.Value
>
</
Setter
>
<
Setter
Property
=
"Geometry"
Value
=
"{telerik:CommonShape ShapeType=EllipseShape}"
/>
<
Setter
Property
=
"Width"
Value
=
"{Binding Width, Mode=TwoWay}"
/>
<
Setter
Property
=
"Height"
Value
=
"{Binding Height, Mode=TwoWay}"
/>
<
Setter
Property
=
"ZIndex"
Value
=
"{Binding ZIndex, Mode=TwoWay}"
/>
<
Setter
Property
=
"ContentTemplate"
>
<
Setter.Value
>
<
DataTemplate
>
<
TextBlock
Text
=
"{Binding ZIndex}"
/>
</
DataTemplate
>
</
Setter.Value
>
</
Setter
>
</
Style
>
</
Window.Resources
>
Note that the shape's NormalContent displays the ZIndex.
Finally, I have a RadNumericUpDown that controls the ZIndex of the SelectedItem in the RadDiagram
<
DockPanel
>
<
telerik:RadNumericUpDown
Value
=
"{Binding SelectedItem.ZIndex, ElementName=diagram}"
/>
<
telerik:RadDiagram
x:Name
=
"diagram"
/>
</
DockPanel
>
I'll attach a screenshot that shows that, even though the ZIndex has changed, the order of shapes on the diagram has not. In the screenshot, you can see that everything appears as it should be -- the ZIndexes of my models are correctly reflected in bindings of the RadDiagramShape, selection bindings work, and changes in the RadNumericUpDown are reflected in the bindings.
However, changes to RadDiagramItem.ZIndex are completely ignored by the RadDiagram, both when initially added, and forever thereafter. What's the point of the ZIndex property when it doesn't work?
If bug, you are hereby notified. If not, you need this feature request. Either way, I could use some help with a workaround.