private bool HasClusteredFeatureLayers() { LayerInfo info = LayerInfos != null? LayerInfos.FirstOrDefault(li => li.Layer != null && li.Layer.Clusterer != null) : null; return(info != null); }
private void RefreshLayerIds() { if (LayerInfos != null) { IEnumerable <string> idsAsStr = LayerInfos.Where(inf => inf.IsChecked == true).Select(info => info.Layer.ID).Distinct(); if (idsAsStr != null) { LayerIds = idsAsStr.ToArray(); } foreach (LayerInfo info in LayerInfos) { bool included = info.Layer != null && !string.IsNullOrWhiteSpace(info.Layer.ID) && LayerIds.Contains(info.Layer.ID); info.Layer.SetValue(LayerProperties.IsEditableProperty, included); } } }
public override void AddConfigUI(System.Windows.Controls.Grid grid) { TextBlock label; #region Header grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); Grid g = new Grid(); g.ColumnDefinitions.Add(new ColumnDefinition()); g.ColumnDefinitions.Add(new ColumnDefinition()); g.RowDefinitions.Add(new RowDefinition()); label = new TextBlock() { Text = Name, VerticalAlignment = System.Windows.VerticalAlignment.Center, Margin = new Thickness(2, 10, 2, 2), FontWeight = FontWeights.Bold, TextTrimming = TextTrimming.WordEllipsis }; g.Children.Add(label); g.SetValue(Grid.RowProperty, grid.RowDefinitions.Count - 1); g.SetValue(Grid.ColumnSpanProperty, 2); grid.Children.Add(g); #endregion #region Type grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); label = new TextBlock() { Text = Resources.Strings.LabelType, Margin = new Thickness(2), VerticalAlignment = System.Windows.VerticalAlignment.Center }; label.SetValue(Grid.RowProperty, grid.RowDefinitions.Count - 1); grid.Children.Add(label); label = new TextBlock() { Text = Type.ToString(), Margin = new Thickness(2), VerticalAlignment = System.Windows.VerticalAlignment.Center }; label.SetValue(Grid.RowProperty, grid.RowDefinitions.Count - 1); label.SetValue(Grid.ColumnProperty, 1); grid.Children.Add(label); #endregion #region Layer name grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); label = new TextBlock() { Text = Resources.Strings.LabelLayerName, Margin = new Thickness(2), VerticalAlignment = System.Windows.VerticalAlignment.Center }; label.SetValue(Grid.RowProperty, grid.RowDefinitions.Count - 1); grid.Children.Add(label); TextBox tb = new TextBox() { Text = LayerName, Margin = new Thickness(2), HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch, }; tb.SetValue(Grid.RowProperty, grid.RowDefinitions.Count - 1); tb.SetValue(Grid.ColumnProperty, 1); grid.Children.Add(tb); tb.TextChanged += (s, e) => { LayerName = tb.Text; }; #endregion #region Popups config if (SupportsJobResource && LayerInfos != null && LayerInfos.Count > 0 && LayerInfos.All(l => l.Fields != null && l.Fields.Count > 0)) { grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); label = new TextBlock() { Text = Resources.Strings.LabelPopUps, Margin = new Thickness(2), VerticalAlignment = System.Windows.VerticalAlignment.Center }; label.SetValue(Grid.RowProperty, grid.RowDefinitions.Count - 1); grid.Children.Add(label); Button popupButton = new Button { Content = new Image { Source = new BitmapImage(new Uri("/ESRI.ArcGIS.Mapping.GP;component/Images/Show_Popup16.png", UriKind.Relative)), Stretch = Stretch.None, VerticalAlignment = System.Windows.VerticalAlignment.Center, HorizontalAlignment = System.Windows.HorizontalAlignment.Center }, Width = 22, HorizontalAlignment = HorizontalAlignment.Left, Style = Application.Current.Resources["SimpleButtonStyle"] as Style }; ToolTipService.SetToolTip(popupButton, Resources.Strings.ConfigurePopupFieldAliasesAndVisibility); popupButton.Click += popupButton_Click; popupButton.SetValue(Grid.RowProperty, grid.RowDefinitions.Count - 1); popupButton.SetValue(Grid.ColumnProperty, 1); grid.Children.Add(popupButton); } #endregion #region Opacity grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); label = new TextBlock() { Text = Resources.Strings.LabelTransparency, Margin = new Thickness(2), VerticalAlignment = System.Windows.VerticalAlignment.Top }; label.SetValue(Grid.RowProperty, grid.RowDefinitions.Count - 1); grid.Children.Add(label); ContentControl sliderOpacity = new ContentControl() { DataContext = this, Style = ResourceUtility.LoadEmbeddedStyle("Themes/HorizontalTransparencySlider.xaml", "TransparencySliderStyle") }; sliderOpacity.SetValue(Grid.RowProperty, grid.RowDefinitions.Count - 1); sliderOpacity.SetValue(Grid.ColumnProperty, 1); grid.Children.Add(sliderOpacity); #endregion }