ZIndex bindings are ignored

5 posts, 1 answers
  1. Will
    Will avatar
    11 posts
    Member since:
    Apr 2012

    Posted 13 Aug 2012 Link to this post

    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.

    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.
  2. Answer
    Miro Miroslavov
    Admin
    Miro Miroslavov avatar
    588 posts

    Posted 15 Aug 2012 Link to this post

    Hi Will,

     After deep investigation I found out that the ZIndex Style binding gets disconnected because we assign the ZIndex property in our Shape's constructor. This is needed because the Shapes and the Connections have different ZIndicies. I consider this as an issue and so I created a work item for it. It should be fixed soon for some of the minor releases.
    On a side note, you can use the DiagramItem's ZIndex directly or you can use our Commands or Methods - BrindForward and so on. 
    Sorry for any inconvenience. 
    I've also updated your Telerik points. 

    All the best,
    Miro Miroslavov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Derrick
    Derrick avatar
    3 posts
    Member since:
    Sep 2012

    Posted 27 Sep 2012 Link to this post

    Is there a timeline for this issue to be fixed? I checked in the latest internal build and the bug is still there.
  5. Miro Miroslavov
    Admin
    Miro Miroslavov avatar
    588 posts

    Posted 29 Sep 2012 Link to this post

    Hi Derrick,

     The issue is not scheduled yet, but we'll do our best to fix it for our incoming in a few weeks Q3.2012 release.
    Hope this time frame is ok for you. 

    All the best,
    Miro Miroslavov
    the Telerik team

    Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

  6. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 18 Oct 2012 Link to this post

    Hi Derrick,

    This issue is now resolved in Q3 2012. We highly encourage to upgrade and also try the new Diagramming features - Gliding Connectors (could be seen in the Class Diagram Demo), Drawing Features, ShapeContainers (could be seen in FirstLookDemo), Export To HTML.

    Kind regards,
    Petar Mladenov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top
UI for WPF is Visual Studio 2017 Ready