I have a database grid from the database, so I can make changes and changes in the database.
However, you can not sort columns by clicking on the header. Nothing happens when you click on them I have seen so many questions on the SO. In this way, and I have changed my XML Lot and have tried different things, but no answer has been decided for me.
This is my C #.
public window 1) {initial group (); LoadDataGrid (); } Private Zero LoadData Grid () {Task DataContext Function DB = New Work DatatyText (); Var function = (Select functions from P. DB. Lubutk P); MyDataGrid.ItemsSource = Work; }
Here's the XMAL I tried with the first tutorial:
& lt; Grid: DataGrid name = "MyDataGrid" CanUserSortColumns = "True" & gt; & Lt; Grid: DataGrid.Columns & gt; & Lt; Grid: DataGridTextColumnBinding = "{Binding Path = Number}" Header = "Number" CanUserSort = "True" /> & Lt; Grid: DataGridTextColumn Binding = "{Binding Path = Description}" Header = "Description" CanUserSort = "True" /> & Lt; / Grid: DataGrid.Columns & gt; & Lt; / Grid: DataGrid & gt; I tried to add things like SortMemberPath = "Number.code"
or SortMemberPath = "Number"
and with different tags Turned around
I also tried a structure like another tutorial, but it also does not work.
& lt; Grid: Datagrid name = "Myadatgrid" Cancellous Column = "True" items Source = "{Binding}" & gt; & Lt; Grid: DataGrid.Columns & gt; & Lt; Grid: DataGrade Template Columns SortMailPath = "Number" Cancersource = "True" & gt; & Lt; Grid: DataGrade Template Columns Columns & gt; & Lt; DataTemplate & gt; & Lt; TextBlock & gt; & Lt; TextBlock.Text & gt; & Lt; Binding path = "number" /> & Lt; /TextBlock.Text> & Lt; / TextBlock & gt; & Lt; / DataTemplate & gt; & Lt; / Grid: DataGridTemplateColumn.CellTemplate & gt; & Lt; / Grid: DataGridTemplateColumn & gt; & Lt; Grid: DataGrade Template Column SortmailPath = "Details" CanUserSort = "true" & gt; & Lt; Grid: DataGrade Template Columns Columns & gt; & Lt; DataTemplate & gt; & Lt; TextBlock & gt; & Lt; TextBlock.Text & gt; & Lt; Binding Path = "Details" /> & Lt; /TextBlock.Text> & Lt; / TextBlock & gt; & Lt; / DataTemplate & gt; & Lt; / Grid: DataGridTemplateColumn.CellTemplate & gt; & Lt; / Grid: DataGridTemplateColumn & gt; & Lt; / Grid: DataGrid.Columns & gt; & Lt; / Grid: Data grid & gt;
Do I populate the datagrid? I have tried to use MyDataGrid.DataContext = tasks;
But if I do this then I can not take it at all to fill the data grid.
Thank you very much for any suggestions.
From the database in a straight supporting your LINQ result sorting
Try it:
Task DataContext functions DB = new datatytext (); Var function = (Select functions from P. DB. Lubutk p) .Oolist (); MyDataGrid.ItemsSource = Work;
No comments:
Post a Comment