<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Layer name not visible in DropDown in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/layer-name-not-visible-in-dropdown/m-p/1224507#M8945</link>
    <description>&lt;P&gt;I was missing iNotifyChangedEvent.Its Working&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Sun, 23 Oct 2022 11:20:48 GMT</pubDate>
    <dc:creator>Nadir_Hussain</dc:creator>
    <dc:date>2022-10-23T11:20:48Z</dc:date>
    <item>
      <title>Layer name not visible in DropDown</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/layer-name-not-visible-in-dropdown/m-p/1224505#M8944</link>
      <description>&lt;P&gt;Dear All&lt;/P&gt;&lt;P&gt;i m working on addins.On my dockpane i have one drop down.i want to get all layer on drawComplete map event.After completion of draw event i check all there layers are in observable collection.But when i checked my drop down i did not find any layer there.please help.Actually this is my first addin in ArcGIS pro SDK.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-------------------------MY VIEW-----------------------------&lt;/P&gt;&lt;P&gt;&amp;lt;DockPanel Grid.Column="0" Grid.ColumnSpan="1" Grid.RowSpan="1" Grid.Row="0" FlowDirection="RightToLeft" Background="Transparent" ScrollViewer.VerticalScrollBarVisibility="Visible"&amp;gt;&lt;BR /&gt;&amp;lt;Grid x:Name="panelGrid" Background="Transparent" Margin="0,0,0,0"&amp;gt;&lt;BR /&gt;&amp;lt;Grid.RowDefinitions&amp;gt;&lt;BR /&gt;&amp;lt;RowDefinition Height="12*"&amp;gt;&amp;lt;/RowDefinition&amp;gt;&lt;BR /&gt;&amp;lt;RowDefinition Height="12*"&amp;gt;&amp;lt;/RowDefinition&amp;gt;&lt;BR /&gt;&amp;lt;RowDefinition Height="76*"&amp;gt;&amp;lt;/RowDefinition&amp;gt;&lt;BR /&gt;&amp;lt;/Grid.RowDefinitions&amp;gt;&lt;BR /&gt;&amp;lt;Grid.ColumnDefinitions&amp;gt;&lt;BR /&gt;&amp;lt;ColumnDefinition Width="*"&amp;gt;&amp;lt;/ColumnDefinition&amp;gt;&lt;BR /&gt;&amp;lt;/Grid.ColumnDefinitions&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;lt;Label Content="hhh" Width="30" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Column="0" Grid.Row="0" Margin="5,5,5,5"/&amp;gt;&lt;BR /&gt;&amp;lt;ComboBox Width="400" Height="30" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Column="1" Grid.Row="0" Margin="5,5,5,5" ItemsSource="{Binding ddMapLayers}"&amp;gt;&lt;BR /&gt;&amp;lt;/ComboBox&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;lt;/Grid&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;------------------My VIEW MODEL--------------------------------------&lt;/P&gt;&lt;P&gt;internal class MainDockpaneViewModel : DockPane&lt;BR /&gt;{&lt;BR /&gt;private const string _dockPaneID = "ProMOPConfigTool_MainDockpane";&lt;BR /&gt;private const string _menuID = "ProMOPConfigTool_MainDockpane_Menu";&lt;BR /&gt;private readonly object _lockCollection = new object();&lt;BR /&gt;public event PropertyChangedEventHandler PropertyChanged;&lt;BR /&gt;//***************************************************************//&lt;BR /&gt;private bool _subscribed;&lt;BR /&gt;private object _lock = new object();&lt;BR /&gt;//***************************************************************//&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;private ObservableCollection&amp;lt;string&amp;gt; _ddMapLayers;&lt;BR /&gt;public System.Collections.ObjectModel.ObservableCollection&amp;lt;string&amp;gt; ddMapLayers&lt;BR /&gt;{&lt;BR /&gt;get { return _ddMapLayers; }&lt;BR /&gt;set&lt;BR /&gt;{&lt;BR /&gt;_ddMapLayers = value;&lt;BR /&gt;OnPropertyChanged("ddMapLayers");&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;protected MainDockpaneViewModel() {&lt;BR /&gt;ddMapLayers = new ObservableCollection&amp;lt;string&amp;gt;();&lt;BR /&gt;Utils.RunOnUiThread(() =&amp;gt;&lt;BR /&gt;{&lt;BR /&gt;BindingOperations.EnableCollectionSynchronization(ddMapLayers, _lockCollection);&lt;BR /&gt;&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;//****************************************************************************************************************************//&lt;/P&gt;&lt;P&gt;protected override void OnShow(bool isVisible)&lt;BR /&gt;{&lt;BR /&gt;if (isVisible)&lt;BR /&gt;{&lt;BR /&gt;//Module1.Current.DefFilterVM = this;&lt;BR /&gt;if (!_subscribed)&lt;BR /&gt;{&lt;BR /&gt;_subscribed = true;&lt;/P&gt;&lt;P&gt;// connect to events&lt;BR /&gt;&lt;BR /&gt;ArcGIS.Desktop.Mapping.Events.DrawCompleteEvent.Subscribe(OnDrawComplete);&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;if (_subscribed)&lt;BR /&gt;{&lt;BR /&gt;_subscribed = false;&lt;BR /&gt;// unsubscribe from events&lt;BR /&gt;//ArcGIS.Desktop.Mapping.Events.ActiveMapViewChangedEvent.Unsubscribe(OnActiveMapViewChanged);&lt;BR /&gt;ArcGIS.Desktop.Mapping.Events.DrawCompleteEvent.Unsubscribe(OnDrawComplete);&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;base.OnShow(isVisible);&lt;BR /&gt;}&lt;BR /&gt;private async void OnDrawComplete(MapViewEventArgs obj)&lt;BR /&gt;{&lt;BR /&gt;MapView mapView = MapView.Active;&lt;BR /&gt;try&lt;BR /&gt;{&lt;BR /&gt;if (obj == null)&lt;BR /&gt;return;&lt;BR /&gt;var mapItem = obj.MapView.Map as Map;&lt;BR /&gt;if (mapItem == null)&lt;BR /&gt;return;&lt;BR /&gt;ddMapLayers.Clear();&lt;BR /&gt;if (mapView == null)&lt;BR /&gt;&lt;BR /&gt;System.Windows.MessageBox.Show("Null");&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;//for (int i = 0; i &amp;lt; MapView.Active.Map.GetLayersAsFlattenedList().OfType&amp;lt;FeatureLayer&amp;gt;().ToList().Count; i++)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;await QueuedTask.Run(() =&amp;gt;&lt;BR /&gt;{&lt;BR /&gt;&lt;BR /&gt;if (mapView == null)&lt;BR /&gt;System.Windows.MessageBox.Show("Null");&lt;BR /&gt;else&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;ddMapLayers =LoopThroughLayersAndLoadSelectablelayersOfSpecificUIDAsync(MapView.Active.Map).Result;&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;catch (Exception Ex)&lt;BR /&gt;{&lt;BR /&gt;MessageBox.Show(Ex.Message.ToString());&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;public async Task&amp;lt;ObservableCollection&amp;lt;string&amp;gt;&amp;gt; LoopThroughLayersAndLoadSelectablelayersOfSpecificUIDAsync(Map map)&lt;BR /&gt;{&lt;BR /&gt;ObservableCollection&amp;lt;string&amp;gt; ddColl = null;&lt;BR /&gt;//try&lt;BR /&gt;//{&lt;BR /&gt;ddColl=new ObservableCollection&amp;lt;string&amp;gt;();&lt;BR /&gt;return await QueuedTask.Run(() =&amp;gt;&lt;BR /&gt;{&lt;BR /&gt;for (int i = 0; i &amp;lt; map.GetLayersAsFlattenedList().OfType&amp;lt;FeatureLayer&amp;gt;().ToList().Count; i++)&lt;BR /&gt;&lt;BR /&gt;{&lt;BR /&gt;var layer = map.GetLayersAsFlattenedList().OfType&amp;lt;FeatureLayer&amp;gt;().ToList()[i];&lt;BR /&gt;ddColl.Add(layer.Name.Replace("_", " "));&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;MessageBox.Show(ddColl.Count.ToString());&lt;BR /&gt;return ddColl;&lt;/P&gt;&lt;P&gt;});&lt;BR /&gt;&lt;BR /&gt;//}&lt;BR /&gt;//catch (Exception ex)&lt;BR /&gt;//{&lt;BR /&gt;// string strex = ex.Message.ToString();&lt;BR /&gt;// System.Windows.MessageBox.Show("No layers of type: " + strex.ToString()); //uid.Value.ToString&lt;BR /&gt;//}&lt;BR /&gt;//finally&lt;BR /&gt;//{&lt;/P&gt;&lt;P&gt;//}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;private void OnActiveMapViewChanged(ActiveMapViewChangedEventArgs obj)&lt;BR /&gt;{&lt;BR /&gt;//Module1.Current.DefFilterVM = this; //Remove this.&lt;BR /&gt;//GetMapMembers(MapView.Active);&lt;BR /&gt;//InitializeFilters();&lt;BR /&gt;}&lt;BR /&gt;public void OnMapMemberPropertiesChanged(MapMemberPropertiesChangedEventArgs obj)&lt;BR /&gt;{&lt;BR /&gt;//if (SelectedMapMember == null)&lt;BR /&gt;// return;&lt;BR /&gt;//if (obj.MapMembers.Contains(SelectedMapMember))&lt;BR /&gt;// InitializeFilters();&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;//*****************************************************************************************************************************//&lt;BR /&gt;/// &amp;lt;summary&amp;gt;&lt;BR /&gt;/// Show the DockPane.&lt;BR /&gt;/// &amp;lt;/summary&amp;gt;&lt;BR /&gt;internal static void Show()&lt;BR /&gt;{&lt;BR /&gt;DockPane pane = FrameworkApplication.DockPaneManager.Find(_dockPaneID);&lt;BR /&gt;if (pane == null)&lt;BR /&gt;return;&lt;/P&gt;&lt;P&gt;pane.Activate();&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;/// &amp;lt;summary&amp;gt;&lt;BR /&gt;/// Text shown near the top of the DockPane.&lt;BR /&gt;/// &amp;lt;/summary&amp;gt;&lt;BR /&gt;&lt;BR /&gt;private RelayCommand _DrawCircleButton_2;&lt;/P&gt;&lt;P&gt;public ICommand DrawCircleButton_2&lt;BR /&gt;{&lt;BR /&gt;get&lt;BR /&gt;{&lt;BR /&gt;if (_DrawCircleButton_2 == null)&lt;BR /&gt;{&lt;BR /&gt;_DrawCircleButton_2 = new RelayCommand(OnClick, true);&lt;BR /&gt;}&lt;BR /&gt;return _DrawCircleButton_2;&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;protected virtual void OnPropertyChanged(string propertyName)&lt;BR /&gt;{&lt;BR /&gt;OnPropertyChanged(new PropertyChangedEventArgs(propertyName));&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;protected virtual void OnPropertyChanged(PropertyChangedEventArgs args)&lt;BR /&gt;{&lt;BR /&gt;var handler = PropertyChanged;&lt;BR /&gt;handler?.Invoke(this, args);&lt;BR /&gt;}&lt;BR /&gt;public void OnClick()&lt;BR /&gt;{&lt;BR /&gt;try&lt;BR /&gt;{&lt;BR /&gt;System.Windows.MessageBox.Show("You Click Draw 2");&lt;BR /&gt;}&lt;BR /&gt;catch (Exception ex) {&lt;/P&gt;&lt;P&gt;Console.Write(ex.InnerException.ToString());&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;private string _heading = "My DockPane";&lt;BR /&gt;public string Heading&lt;BR /&gt;{&lt;BR /&gt;get { return _heading; }&lt;BR /&gt;set&lt;BR /&gt;{&lt;BR /&gt;SetProperty(ref _heading, value, () =&amp;gt; Heading);&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;#region Burger Button&lt;/P&gt;&lt;P&gt;/// &amp;lt;summary&amp;gt;&lt;BR /&gt;/// Tooltip shown when hovering over the burger button.&lt;BR /&gt;/// &amp;lt;/summary&amp;gt;&lt;BR /&gt;public string BurgerButtonTooltip&lt;BR /&gt;{&lt;BR /&gt;get { return "Options"; }&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;/// &amp;lt;summary&amp;gt;&lt;BR /&gt;/// Menu shown when burger button is clicked.&lt;BR /&gt;/// &amp;lt;/summary&amp;gt;&lt;BR /&gt;public System.Windows.Controls.ContextMenu BurgerButtonMenu&lt;BR /&gt;{&lt;BR /&gt;get { return FrameworkApplication.CreateContextMenu(_menuID); }&lt;BR /&gt;}&lt;BR /&gt;#endregion&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;/// &amp;lt;summary&amp;gt;&lt;BR /&gt;/// Button implementation to show the DockPane.&lt;BR /&gt;/// &amp;lt;/summary&amp;gt;&lt;BR /&gt;internal class MainDockpane_ShowButton : Button&lt;BR /&gt;{&lt;BR /&gt;protected override void OnClick()&lt;BR /&gt;{&lt;BR /&gt;MainDockpaneViewModel.Show();&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;/// &amp;lt;summary&amp;gt;&lt;BR /&gt;/// Button implementation for the button on the menu of the burger button.&lt;BR /&gt;/// &amp;lt;/summary&amp;gt;&lt;BR /&gt;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Sun, 23 Oct 2022 11:07:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/layer-name-not-visible-in-dropdown/m-p/1224505#M8944</guid>
      <dc:creator>Nadir_Hussain</dc:creator>
      <dc:date>2022-10-23T11:07:04Z</dc:date>
    </item>
    <item>
      <title>Re: Layer name not visible in DropDown</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/layer-name-not-visible-in-dropdown/m-p/1224507#M8945</link>
      <description>&lt;P&gt;I was missing iNotifyChangedEvent.Its Working&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Sun, 23 Oct 2022 11:20:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/layer-name-not-visible-in-dropdown/m-p/1224507#M8945</guid>
      <dc:creator>Nadir_Hussain</dc:creator>
      <dc:date>2022-10-23T11:20:48Z</dc:date>
    </item>
  </channel>
</rss>

