I am getting close but can;t quite get it to populate the datagrid. The code below gets me the correct number of features that should be in the datagrid and even adds the correct number of rows to the table. However, the table rows do not contain any data. So close and I feel like it is something very easy that I am missing. Ideas anyone?XAML <sdk:DataGrid AutoGenerateColumns="True" Height="236" HorizontalAlignment="Left" Margin="12,52,0,0" Name="dg1" VerticalAlignment="Top" Width="476">
<sdk:DataGrid.Columns>
<!--<sdk:DataGridTextColumn Binding="{Binding Path=OID}" SortMemberPath="OID" Header="OID"/>-->
<!--<sdk:DataGridTextColumn Binding="{Binding Path=LossDt}" SortMemberPath="LossDt" Header="LossDt"/>-->
<!--<sdk:DataGridTextColumn Binding="{Binding Path=FREQUENCY}" SortMemberPath="FREQUENCY" Header="FREQUENCY"/>-->
<sdk:DataGridTextColumn Binding="{Binding MEAN_LossA}" SortMemberPath="MEAN_LossA" Header="MEAN_LossA"/>
<!--<sdk:DataGridTextColumn Binding="{Binding Path=SUM_LossAm}" SortMemberPath="SUM_LossAm" Header="SUM_LossAm"/>-->
<!--<sdk:DataGridTextColumn Binding="{Binding Path=MEAN_ExpAm}" SortMemberPath="MEAN_ExpAm" Header="MEAN_ExpAm"/>-->
<!--<sdk:DataGridTextColumn Binding="{Binding Path=SUM_ExpAmt}" SortMemberPath="SUM_ExpAmt" Header="SUM_ExpAmt"/>-->
</sdk:DataGrid.Columns>
</sdk:DataGrid>
XAML CS
public interface HailData {}
public class HailAttributes : HailData
{
//public double OID;
//public string LossDt;
// public double FREQUENCY;
public string MEAN_LossA;
//public double SUM_LossAm;
//public double MEAN_ExpAm;
//public double SUM_ExpAmt;
}
public string MEAN_LossA
{
get { return MEAN_LossA; }
}
private void GeoprocessorTask_ExecuteCompleted(object sender, ESRI.ArcGIS.Client.Tasks.GPExecuteCompleteEventArgs e)
{
try
{
this.dg1.ItemsSource = null;
foreach (GPParameter gpParameter in e.Results.OutParameters)
if (gpParameter.Name == "output_dbf")
{
GPRecordSet gpLayer = gpParameter as GPRecordSet;
List<HailData> theList = new List<HailData>();
foreach (Graphic feature in gpLayer.FeatureSet.Features)
{
//MessageBox.Show(feature.Attributes["MEAN_LossA"].ToString());
theList.Add(new HailAttributes()
{
//OID = Convert.ToDouble(feature.Attributes["OID"]),
//LossDt = feature.Attributes["LossDt"].ToString(),
//FREQUENCY = Convert.ToDouble(feature.Attributes["FREQUENCY"]),
MEAN_LossA = feature.Attributes["MEAN_LossA"].ToString(),
//SUM_LossAm = Convert.ToDouble(feature.Attributes["SUM_LossAm"]),
//MEAN_ExpAm = Convert.ToDouble(feature.Attributes["MEAN_ExpAm"]),
//SUM_ExpAmt = Convert.ToDouble(feature.Attributes["SUM_ExpAmt"]),
});
}
MessageBox.Show(theList.Count().ToString());
this.dg1.ItemsSource = theList;
}
btnPoint.IsEnabled = true;
}
catch (OverflowException oEx)
{
MessageBox.Show(oEx.Message);
btnPoint.IsEnabled = true;
}
catch (FormatException fEx)
{
MessageBox.Show(fEx.Message);
btnPoint.IsEnabled = true;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + " stacktrace:" + ex.StackTrace);
btnPoint.IsEnabled = true;
}
}