Diagram's Panel not available

Hi,

I use the slider control for zoom function of the diagram. I bind the panel's scale property to the slider's value in the diagram's loaded event. Sometimes the panel is null & hence the slider is not functional. Below is the code snippet: [code] diagramObj.Loaded += (s, e) => { var diagram = s as Diagram; if (diagram.Tag == null) { diagram.Tag = "Initialized";
    var b = new System.Windows.Data.Binding("Scale");
    b.Source = diagram.Panel; <b><font color="#FF0000">// Sometimes</font></b> <b><font color="#FF0000">diagram.Panel is null</font></b>
    b.Mode = System.Windows.Data.BindingMode.TwoWay;
    zoomSlider.SetBinding(RadSlider.ValueProperty, b);

    diagram.AllowMove = diagram.AllowEdit = diagram.AllowScroll = diagram.AllowUndo =
    diagram.AllowZoom = diagram.AllowDrop = true;

    TreeLayout tl = new TreeLayout();
    tl.Angle = 0;
    tl.NodeSpacing = 35;
    diagram.Layout = tl;
    diagram.LayoutManager.Animated = false;
}

};
[/code]
How do I make sure that the panel is available for binding every time?

Thanks.

Take a look at the OrgChart sample.
It does that initialization in a Diagram.TemplateApplied event handler.

It works fine now. Thanks Walter.