public override void OnApplyTemplate()
 {
     if (mapTipsLayerConfig != null)
         mapTipsLayerConfig.DisplayFieldChanged -= mapTipsLayerConfig_DisplayFieldChanged;
     base.OnApplyTemplate();
     mapTipsLayerConfig = GetTemplateChild("MapTipsLayerConfig") as MapTipsLayerConfig;
     if (mapTipsLayerConfig != null)
         mapTipsLayerConfig.DisplayFieldChanged += mapTipsLayerConfig_DisplayFieldChanged;
     bindUIToLayer();
 }
 public override void OnApplyTemplate()
 {
     if (mapTipsLayerConfig != null)
     {
         mapTipsLayerConfig.DisplayFieldChanged -= mapTipsLayerConfig_DisplayFieldChanged;
     }
     base.OnApplyTemplate();
     mapTipsLayerConfig = GetTemplateChild("MapTipsLayerConfig") as MapTipsLayerConfig;
     if (mapTipsLayerConfig != null)
     {
         mapTipsLayerConfig.DisplayFieldChanged += mapTipsLayerConfig_DisplayFieldChanged;
     }
     bindUIToLayer();
 }
        static void OnInfoChanged(DependencyObject o, DependencyPropertyChangedEventArgs args)
        {
            MapTipsLayerConfig config = o as MapTipsLayerConfig;

            if (config != null)
            {
                if (config.Info != null)
                {
                    config.Info.PropertyChanged += config.Info_PropertyChanged;
                    config.Layer     = config.Info.Layer;
                    config.LayerInfo = config.Info.SelectedItem;
                }
                config.bindUI();
            }
        }
        void AssociatedObject_Clicked(object sender, RoutedEventArgs e)
        {
            MapTipsLayerConfig mapTipsConfig = ControlTreeHelper.FindAncestorOfType <MapTipsLayerConfig>(AssociatedObject);

            if (mapTipsConfig != null)
            {
                if (AssociatedObject.IsChecked.Value)
                {
                    mapTipsConfig.FieldInfo_MapTipVisiblityChecked(this.AssociatedObject.DataContext as FieldInfo);
                }
                else
                {
                    mapTipsConfig.FieldInfo_MapTipVisibilityUnChecked(this.AssociatedObject.DataContext as FieldInfo);
                }
            }
        }