POST
|
I am using the �??Query task without map" -(http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#QueryWithoutMap) from the samples - here, if I want to perform the query operation on the "Region" field instead of "State Name" field. Could you please suggest me as what changes should I make in the code in Xaml & Xaml.cs. Thanks for your Suggestions!
... View more
11-09-2011
07:50 AM
|
0
|
2
|
480
|
POST
|
Jennifer, Thanks for taking your precious time to work on this. The field value for which I want to filter is not of graphic layer attribute. It's a field of a table layer. Right now for this program, I am using the service which is available at arc gis online - http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/TaxParcel/AssessorsBasemap/MapServer/33. I am still figuring out as how to pass the attribute VALUEINFO to the CollectionViewSource. I am working on it â?? and this is what I came up with, I am still looking on as how to set the datasource to CollectionViewSource similar to the below program sample: Google Search <UserControl.Resources> <local:DataSource x:Key="dataSource" /> <CollectionViewSource x:Name="cvs" Source="{Binding Names, Source={StaticResource dataSource}}"> </CollectionViewSource> </UserControl.Resources> Ourâ??s <UserControl.Resources> <CollectionViewSource x:Name="cvs" x:Key="MyCollectionViewSource" Source="{Binding Attributes[VALUEINFO], Source={StaticResource â?¦â?¦â?¦â?¦â?¦â?¦â?¦..}}"/> </UserControl.Resources> Please provide me if you have any inputs on this, as how to move forward with the requirement that I have. Thanks for your time! How do you get values for your CollectionViewSource? I understand it is bound to only one attribute value but is it from a GraphicCollection? You may also need to update your Binding statement for ListBox.ItemsSource to since you are pointing to a resource ItemsSource="{Binding Source={StaticResource cvs}}" To demonstrate how you can filter using CollectionViewSource, I updated this SDK sample: http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#QueryWithoutMap XAML-code changes: DataGrid.ItemsSource is set through binding to CollectionViewSource
<Grid.Resources>
<CollectionViewSource x:Key="MyCollectionViewSource"/>
</Grid.Resources>
<slData:DataGrid x:Name="QueryDetailsDataGrid" AutoGenerateColumns="False" HeadersVisibility="Column" Background="White"
IsReadOnly="True" Canvas.Left="10" Canvas.Top="50" Height="140" Width="530"
HorizontalScrollBarVisibility="Hidden"
ItemsSource="{Binding Source={StaticResource MyCollectionViewSource}}"
>
Code-behind changes: Query once and update cvs.Source on Button.Click.
public MainPage()
{
InitializeComponent();
cvs = LayoutRoot.Resources["MyCollectionViewSource"] as CollectionViewSource;
QueryTask queryTask =
new QueryTask("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/5");
queryTask.ExecuteCompleted += QueryTask_ExecuteCompleted;
queryTask.Failed += QueryTask_Failed;
ESRI.ArcGIS.Client.Tasks.Query query = new ESRI.ArcGIS.Client.Tasks.Query();
query.Where = "1=1";
query.OutFields.Add("*");
queryTask.ExecuteAsync(query);
}
CollectionViewSource cvs;
void QueryButton_Click(object sender, RoutedEventArgs e)
{
cvs.View.Filter = g =>
{
var graphic = g as Graphic;
if ((graphic.Attributes["STATE_NAME"] as string).ToLower().StartsWith(StateNameTextBox.Text.Trim().ToLower()))
return true;
return false;
};
}
void QueryTask_ExecuteCompleted(object sender, ESRI.ArcGIS.Client.Tasks.QueryEventArgs args)
{
FeatureSet featureSet = args.FeatureSet;
if (featureSet != null && featureSet.Features.Count > 0)
cvs.Source = featureSet.Features;
else
MessageBox.Show("No features returned from query");
}
... View more
11-08-2011
09:08 AM
|
0
|
0
|
189
|
POST
|
MainPage.Xaml <UserControl.Resources> <CollectionViewSource x:Name="cvs" Source="{Binding Attributes[LOG_NUM]}"> </CollectionViewSource> </UserControl.Resources> �������������������������� ������������������������� <ListBox ItemsSource="{Binding Source=cvs}" Canvas.Left="10" Canvas.Top="30" Width="80" Height="20"/> <TextBox x:Name="searchKey" TextChanged="searchKey_TextChanged" Canvas.Left="30" Canvas.Top="30" TextWrapping="Wrap" Grid.ColumnSpan="2" /> [U]MainPage.Xaml.cs public MainPage() { InitializeComponent(); this.cvs.Filter += new FilterEventHandler(cvs_Filter); } void cvs_Filter(object sender, FilterEventArgs e) { e.Accepted=((string)e.Item).ToLower().StartsWith(searchKey.Text.ToLower()); } private void searchKey_TextChanged(object sender, TextChangedEventArgs e) { this.cvs.View.Refresh(); } Here, I wanted to apply "filter" opertaion to the [LOG_NUM] field values. Could you please suggest me ...for passing the values of [LOG_NUM] field present in one of the layer, published as service, what statement should i assign to "e.accepted = ?" e.Accepted=((string)e.Item).ToLower().StartsWith(searchKey.Text.ToLower()); Appreciate for your suggestions!
... View more
11-04-2011
10:33 AM
|
0
|
2
|
2363
|
POST
|
Jennifer, Here, with the arc gis rest services - i am unable to understand how can i intialize the pagecollectionview with the data, that is displayed on the silverlight datagrid based on query task mentioned below. QueryTask queryTask = new QueryTask("http://srimpa22/ArcGIS/rest/services/Structures/MapServer/10"); queryTask.ExecuteCompleted += QueryTask_ExecuteCompleted; queryTask.Failed += QueryTask_Failed; ESRI.ArcGIS.Client.Tasks.Query query = new ESRI.ArcGIS.Client.Tasks.Query(); query.OutFields.Add("*"); query.Where = "1=1"; queryTask.ExecuteAsync(query, "initial"); I would appreciate if you can elaborate on it. The intialization of the data that i did in pagecollectionview below - is it wrong? PagedCollectionView tempListView = new PagedCollectionView("http://srimpa22/ArcGIS/rest/services/Structures/MapServer/10"); Thanks in advance, for providing your suggestions.
... View more
10-10-2011
09:09 AM
|
0
|
0
|
168
|
POST
|
Unable to make datapager work when binded to a silverlight datagrid, could you please provide suggestions on this as how it can done ? this is the non-spatial data (table) published at the rest end point : http://srimpa22/ArcGIS/rest/services/Structures/MapServer/10 - which i used for binding data on the datgrid. please find below the xaml.cs & xaml code : Mainpage.Xaml.cs public MainPage() { InitializeComponent(); QueryTask queryTask = new QueryTask("http://srimpa22/ArcGIS/rest/services/Structures/MapServer/10"); queryTask.ExecuteCompleted += QueryTask_ExecuteCompleted; queryTask.Failed += QueryTask_Failed; ESRI.ArcGIS.Client.Tasks.Query query = new ESRI.ArcGIS.Client.Tasks.Query(); query.OutFields.Add("*"); query.Where = "1=1"; queryTask.ExecuteAsync(query, "initial"); PagedCollectionView tempListView = new PagedCollectionView("http://srimpa22/ArcGIS/rest/services/Structures/MapServer/10"); QueryDetailsDataGrid.ItemsSource = tempListView; TempDataGridDataGridPager.Source = tempListView; } Mainpage.Xaml <Grid> <Grid.RowDefinitions> <RowDefinition></RowDefinition> <RowDefinition Height="Auto"> </RowDefinition> </Grid.RowDefinitions> <slData:DataGrid x:Name="QueryDetailsDataGrid" Grid.Row="0" AutoGenerateColumns="False" HeadersVisibility="Column" Background="White" VerticalScrollBarVisibility="Disabled" IsReadOnly="True" Canvas.Left="10" Canvas.Top="50" Height="140" Width="530"> <slData:DataGrid.Columns> <slData:DataGridTextColumn x:Name ="one" Width="85" CanUserSort="True" Binding="{Binding Attributes[COUNTY]}" Header="County"/> </slData:DataGrid.Columns> </slData:DataGrid> <slData:DataPager x:Name="TempDataGridDataGridPager" Grid.Row="1" DisplayMode="FirstLastPreviousNext" PageSize="5" Source ="{Binding ItemSource, ElementName=QueryDetailsDataGrid}" Canvas.Top="218" Canvas.Left="3"> </slData:DataPager> </Grid> </UserControl> Thanks, Appreciate for your suggestions. Have a wonderful long weekend!
... View more
10-07-2011
06:44 AM
|
0
|
3
|
523
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|