图示
MainWindow:
namespace WpfApplication3 { /// <summary> /// MainWindow.xaml 的交互逻辑 /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } 问题: 如何将list<T> GetXinXiList(int departmentID) 的返回值 绑定到treeview和分页DataGrid?
public StuResult Result { get; set; } private Department studentDao = new Department(); public void Query(int size, int pageIndex) { Result.Total = studentDao.TotalCount; Result.Students = studentDao.XinXiLists.Skip((pageIndex - 1) * size).Take(size).ToList(); } private void PagingDataGrid_PagingChanged(object sender, CustomControlLibrary.PagingChangedEventArgs args) { Query(args.PageSize, args.PageIndex); } } }
XMAL:
<Grid> ......
如何将list<T> GetXinXiList(int departmentID) 的返回值 绑定到treeview和分页DataGrid ? <!--<lib:PagingDataGrid Grid.Column="2" AutoGenerateColumns="False" HorizontalGridLinesBrush="DarkGray" VerticalGridLinesBrush="DarkGray" ItemsSource="{Binding Result.Students,ElementName=self}" Total="{Binding Result.Total,ElementName=self}" PagingChanged="PagingDataGrid_PagingChanged" >--> <lib:PagingDataGrid Grid.Column="2" AutoGenerateColumns="False" HorizontalGridLinesBrush="DarkGray" VerticalGridLinesBrush="DarkGray" ItemsSource="{Binding ElementName='tree', Path=SelectedItem.XinXiLists}" Total="{Binding ElementName='tree', Path=SelectedItem.TotalCount}" > <lib:PagingDataGrid.Columns> <DataGridTextColumn Header="日期" Binding="{Binding ReceiveDate}"/> <DataGridTextColumn Header="摘要" Binding="{Binding Summary}"/> <DataGridTextColumn Header="分数" Binding="{Binding Score}" /> <DataGridTextColumn Header="备注" Binding="{Binding Reamrks}" /> </lib:PagingDataGrid.Columns> </lib:PagingDataGrid> </Grid> </Window>