ArcGISPortalViewer.Controls.LocationDisplayToggle.OnLocationDisplayPropertyChanged C# (CSharp) Method

OnLocationDisplayPropertyChanged() private static method

private static OnLocationDisplayPropertyChanged ( DependencyObject d, DependencyPropertyChangedEventArgs e ) : void
d Windows.UI.Xaml.DependencyObject
e Windows.UI.Xaml.DependencyPropertyChangedEventArgs
return void
        private static void OnLocationDisplayPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var ctrl = (LocationDisplayToggle)d;
            if (e.NewValue != null)
            {
                var b = new Binding()
                {
                    Source = e.NewValue,
                    Path = new PropertyPath("IsEnabled"),
                    Mode = BindingMode.TwoWay
                };
                ctrl.SetBinding(IsLocationEnabledProperty, b);
                b = new Binding()
                {
                    Source = e.NewValue,
                    Path = new PropertyPath("AutoPanMode"),
                    Mode = BindingMode.TwoWay
                };
                ctrl.SetBinding(ModeProperty, b);
            }
            else
            {
                ctrl.SetBinding(IsLocationEnabledProperty, null);
                ctrl.SetBinding(ModeProperty, null);
            }
            ctrl.UpdateIcon();
        }