<ComboBox Text="{Binding ElementName=m_DataGrid, Path=FieldLayouts[0].Fields[0].Label}"/>
<igDP:XamDataGrid Name="m_DataGrid"/>
private void btn1_click(object sender, RoutedEventArgs e)
{
string value1 = cb1.Text.ToString(); string Path1 = GetFolderPath(); btn1.Content = cb1.Text.ToString(); XDocument xdoc = XDocument.Load(Path1 + @"\Africa.xml"); var q = from c in xdoc.Descendants("Africa") orderby ((string)c.Element(cb1.Text).Value) ascending select new { Area = c.Element("Country").Value, //cb1.Text = c.Element(tt).Value //Doesn't work ...What should i do so that the Column name should be the same as the one selected in the Combo-box .. value1 = c.Element(cb1.Text.ToString()).Value // Not working properly...its showing value1 in column }; xdg1.DataSource = q.ToArray(); xdg1.DefaultFieldLayout.Fields[0].Label = "Country"; xdg1.DefaultFieldLayout.Fields[1].Label = cb1.Text.ToString();
string value1 = cb1.Text.ToString();
string Path1 = GetFolderPath();
btn1.Content = cb1.Text.ToString();
XDocument xdoc = XDocument.Load(Path1 + @"\Africa.xml");
var q = from c in xdoc.Descendants("Africa")
orderby ((string)c.Element(cb1.Text).Value) ascending select new { Area = c.Element("Country").Value, //cb1.Text = c.Element(tt).Value //Doesn't work ...What should i do so that the Column name should be the same as the one selected in the Combo-box .. value1 = c.Element(cb1.Text.ToString()).Value // Not working properly...its showing value1 in column };
orderby ((string)c.Element(cb1.Text).Value) ascending
select new
Area = c.Element("Country").Value,
//cb1.Text = c.Element(tt).Value //Doesn't work ...What should i do so that the Column name should be the same as the one selected in the Combo-box ..
value1 = c.Element(cb1.Text.ToString()).Value // Not working properly...its showing value1 in column
};
xdg1.DataSource = q.ToArray();
xdg1.DefaultFieldLayout.Fields[0].Label = "Country";
xdg1.DefaultFieldLayout.Fields[1].Label = cb1.Text.ToString();
}
Joe
Hi -
Here is an MSDN article that discusses XAML PropertyPath syntax: http://msdn2.microsoft.com/en-us/library/ms742451.aspx
I am not familiar with how to use Linq so I can't comment there.
If you want XamDataGrid to sort on particular column you can add a FieldSortDescription for the column to the FieldLayout as discussed in this post: http://forums.infragistics.com/forums/p/4606/21863.aspx#21863
and implement a custom SortComparer to sort the records anyway you like as mentioned in this post: http://forums.infragistics.com/forums/p/5713/25585.aspx#25585
JoeM