Hi allI'm trying to get a second combobox to updata and show data selected on the value from combobox 1heres my codemainpage.xaml.csusing System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using ESRI.ArcGIS.Client.Tasks;
using ESRI.ArcGIS.Client;
namespace ListTest
{
public partial class MainPage : UserControl
{
public List<string> stateNameQuery = new List<string>();
public MainPage()
{
InitializeComponent();
QueryTask queryTask = new QueryTask("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer/2");
queryTask.ExecuteCompleted += QueryTask_ExecuteCompleted;
queryTask.Failed += QueryTask_Failed;
ESRI.ArcGIS.Client.Tasks.Query query = new ESRI.ArcGIS.Client.Tasks.Query();
query.ReturnGeometry = true;
query.OutFields.AddRange(new string[] { "STATE_NAME" });
//query all features
query.Where = "1=1";
queryTask.ExecuteAsync(query);
vejComboBox.ItemsSource = stateNameQuery;
}
void QueryTask_ExecuteCompleted(object sender, ESRI.ArcGIS.Client.Tasks.QueryEventArgs args)
{
FeatureSet featureSet = args.FeatureSet;
if (featureSet != null && featureSet.Features.Count > 0)
//add result to list
foreach (Graphic resultFeature in args.FeatureSet.Features)
{
stateNameQuery.Add(resultFeature.Attributes["STATE_NAME"].ToString());
}
else
MessageBox.Show("No features returned from query");
}
private void QueryTask_Failed(object sender, TaskFailedEventArgs args)
{
MessageBox.Show("Query execute error: " + args.Error);
}
private void comboBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
}
}
}
mainpage.xaml
<UserControl x:Class="ListTest.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:esri="http://schemas.esri.com/arcgis/client/2009"
xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data" mc:Ignorable="d" d:DesignHeight="252" d:DesignWidth="835">
<Grid x:Name="LayoutRoot" Background="White" Height="250" Width="836" VerticalAlignment="Top">
<ComboBox x:Name="vejComboBox"
Width="200" Height="32"
Margin="218,12,418,0"
VerticalAlignment="Top" />
<ComboBox x:Name="comboBox1"
VerticalAlignment="Top"
Height="32" Width="200"
Margin="424,12,212,0"
SelectionChanged="comboBox1_SelectionChanged"/>
</Grid>
</UserControl>
and can this be convertet to autocompleteboxes ???Thanks in advanceMads GrenDenmark.