JPHILLI2_TXDOT

Where do methods (such as OnSelectionChange) for a combo box that is nested in a dockpane go?

Discussion created by JPHILLI2_TXDOT on Jun 3, 2019
Latest reply on Jun 4, 2019 by JPHILLI2_TXDOT

There is plenty of documentation on how to add combo boxes to a toolbar/group from the daml and how to add functionality in the corresponding .cs file.  However, I haven't been able to find any documentation on how to put a combobox in the .xaml file for a dockpane and reference methods.

 

The method I would like to reference is OnSelectionChange:
https://github.com/Esri/arcgis-pro-sdk/wiki/ProGuide-Combo-boxes#determine-when-a-selection-occurs

 

I have my combobox declared in the .xaml

 

<DockPanel Grid.Row="2" Grid.Column="1">
<ComboBox Name ="ProfileBox"
Width="Auto" Height="Auto" IsEditable="True" Background="{DynamicResource Esri_BackgroundPressedBrush}" ItemsSource="{Binding Profiles}"
Foreground="{DynamicResource Esri_TextMenuBrush}">

</ComboBox>
</DockPanel>

 


and I am able to add items to a list and pass them as the source:

 

foreach (var item in profileRead)
{
string name = Path.GetFileNameWithoutExtension(item);

_profiles.Add(name);
}

 

private ObservableCollection<string> _profiles = new ObservableCollection<string>();

 

public ObservableCollection<string> Profiles
{
set
{
SetProperty(ref _profiles, value, () => Profiles);
NotifyPropertyChanged(() => Profiles);
}

get { return _profiles; }

}

 

 

I was able to reference the selection from the xaml.cs file:

public partial class Dockpane1View : UserControl
{
public static ComboBox profileBoxRef = new ComboBox();

 

public Dockpane1View()
{
InitializeComponent();
profileBoxRef = ProfileBox;
}

}

}

 

 

However, I cannot figure out how to implement OnSelectionChange. 

Thanks

JP

Outcomes