void ConfigureButton_Click(object sender, RoutedEventArgs e)
 {
     if (_configControl == null)
     {
         _configControl = new MapContentsConfigControl()
         {
             OkButtonText = ESRI.ArcGIS.Mapping.Controls.MapContents.Resources.Strings.Done,
         };
         _configControl.OkButtonCommand = new DelegateCommand((args) =>
         {
             MapApplication.Current.HideWindow(_configControl);
         });
     }
     _configControl.DataContext = Configuration;
     Configuration.LayerInfos   = GetLayerInfos(Configuration.ExcludedLayerIds);
     MapApplication.Current.ShowWindow(ESRI.ArcGIS.Mapping.Controls.MapContents.Resources.Strings.ConfigureMapContents, _configControl, true, null, null, WindowType.DesignTimeFloating);
 }
        void AssociatedObject_Checked(object sender, RoutedEventArgs e)
        {
            LayerInfo layerInfo = AssociatedObject.DataContext as LayerInfo;

            if (layerInfo != null && layerInfo.Layer != null && !string.IsNullOrWhiteSpace(layerInfo.Layer.ID))
            {
                MapContentsConfigControl parentConfigControl = ControlTreeHelper.FindAncestorOfType <MapContentsConfigControl>(AssociatedObject);
                if (parentConfigControl != null)
                {
                    MapContentsConfiguration conf = parentConfigControl.DataContext as MapContentsConfiguration;
                    if (conf != null)
                    {
                        List <string> excludedLayers = conf.ExcludedLayerIds == null ? null : conf.ExcludedLayerIds.ToList <string>();
                        if (AssociatedObject.IsChecked == true)
                        {
                            if (excludedLayers == null)
                            {
                                conf.ExcludedLayerIds = new string[] { layerInfo.Layer.ID };
                            }
                            else if (!excludedLayers.Contains(layerInfo.Layer.ID))
                            {
                                excludedLayers.Add(layerInfo.Layer.ID);
                                conf.ExcludedLayerIds = excludedLayers.ToArray();
                            }
                        }
                        else
                        {
                            if (excludedLayers != null)
                            {
                                excludedLayers.Remove(layerInfo.Layer.ID);
                                conf.ExcludedLayerIds = excludedLayers.ToArray();
                            }
                        }
                    }
                }
            }
        }
        void ConfigureButton_Click(object sender, RoutedEventArgs e)
        {
            if (_configControl == null)
            {
                _configControl = new MapContentsConfigControl()
                    {
						OkButtonText = ESRI.ArcGIS.Mapping.Controls.MapContents.Resources.Strings.Done,
                    };
                _configControl.OkButtonCommand = new DelegateCommand((args) =>
                {
                    MapApplication.Current.HideWindow(_configControl);
                });
            }
            _configControl.DataContext = Configuration;
            Configuration.LayerInfos = GetLayerInfos(Configuration.ExcludedLayerIds);
            MapApplication.Current.ShowWindow(ESRI.ArcGIS.Mapping.Controls.MapContents.Resources.Strings.ConfigureMapContents, _configControl, true, null, null, WindowType.DesignTimeFloating);
        }