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
770
xamOrgChart. Detecting click on background
posted

I want to deselect the selected node in xamOrgChart when user clicks outside a node, that is, when user clicks the background. I have panning and zooming on. How can I detect user clicks on background in order to deselect the selected node?

Thanks

Parents
  • 28407
    Verified Answer
    posted

     HI Isidoro,

     Wire up charts PreviewMouseLeftButtonDown event and check to see if you moused down on an OrgChartNodeControl.

     If you didnt mouse down on this control, then clear the charts selection.

     Here a code snippet:

    private void chart_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)         {             DependencyObject source = e.OriginalSource as DependencyObject;

                if (source == null) return;

                OrgChartNodeControl cvp = Infragistics.Windows.Utilities.GetAncestorFromType(source, typeof(OrgChartNodeControl), true) as OrgChartNodeControl;

                if (cvp == null)             {                 chart.SelectedNodes.Clear();             }

     Sincerely,

     Matt

     Developer Support Engineer

Reply Children
No Data