<ComboBox x:Name="Selection" Width="200"> <ComboBoxItem Tag="1" Content="1"/> <ComboBoxItem Tag="2" Content="2"/> <ComboBoxItem Tag="3" Content="3"/> </ComboBox>
string ss = Convert.ToString(g.Attributes["status"]);
<ComboBox x:Name="Selection"> <ComboBox.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding}"/> </DataTemplate> </ComboBox.ItemTemplate> </ComboBox>
Selection.ItemsSource = new int[] { 1, 2, 3 }; Selection.SelectedItem = (int)g.Attributes["status"];
<ComboBox x:Name="choices" VerticalAlignment="Top" HorizontalAlignment="Center"> <ComboBox.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding Value}"/> </DataTemplate> </ComboBox.ItemTemplate> </ComboBox>
var l = new FeatureLayer() { Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/HomelandSecurity/operations/FeatureServer/0", Where = "1=1" }; l.OutFields.Add("*"); l.Initialized += (s, e) => { foreach (var f in l.LayerInfo.Fields) { if (f.Domain is CodedValueDomain) { var cvd = f.Domain as CodedValueDomain; choices.ItemsSource = cvd.CodedValues; break; } } }; l.Initialize();
<TextBlock Text="{Binding Value}"/>
var l = new FeatureLayer() { Url = "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/HomelandSecurity/operations/FeatureServer/0", Where = "1=1" }; l.OutFields.Add("*"); l.Initialized += (s, e) => { foreach (var f in l.LayerInfo.Fields) { if (f.Domain is CodedValueDomain) { var cvd = f.Domain as CodedValueDomain; choices.ItemsSource = cvd.CodedValues; break; } } }; l.Initialize();.
l.Initialized += (s, b) => { foreach (var f in l.LayerInfo.Fields) { if (f.Domain is CodedValueDomain) { if (f.Name == "SITE_STATUS") { var cvd1 = f.Domain as CodedValueDomain; SITE_STATUSCB.ItemsSource = cvd1.CodedValues; break; } } } }; l.Initialize();
Selection.ItemsSource = new int[] { 1, 2, 3 };
Selection.SelectedItem = (int)g.Attributes["status"];
Now following no longer works to make the selection... I have tried a number of things without any results?
Code:
Selection.SelectedItem = (int)g.Attributes["status"];
Any thoughts would be greatly appreciated?