C#:过滤DataGrid,该DataGrid从从MySQL服务器获取数据的DataTable绑定

时间:2013-12-06 22:42:56

标签: c# mysql wpf xaml datagrid

这是我的C#代码

private DataTable MyDT= new DataTable();

public Main()
{
    InitializeComponent();

    fillUpList(); //Fills up my DataTable by sending queries to MySQL Server
    myGrid.ItemsSource = StMatID.DefaultView;            
}

这是我的XAML代码

<DataGrid x:Name="myGrid" ItemsSource="{Binding}" 
            AutoGenerateColumns="True"
            filter:DataGridExtensions.UseBackgroundWorkerForFiltering="True"
            filter:DataGridExtensions.IsClearButtonVisible="False"
            filter:DataGridExtensions.IsFilterVisible=
              "{Binding Path=IsChecked, ElementName=ShowHideFilterCheckBox, Mode=TwoWay}"
            ColumnHeaderStyle=
              "{StaticResource 
                  {ComponentResourceKey 
                     TypeInTargetAssembly=
                        {x:Type filter:DataGridHeaderFilterControl},
                     ResourceId=DataGridHeaderFilterControlStyle}}"
            Grid.Row="0">                        
</DataGrid>



            </Grid>

我正在使用DataGridFilterLibrary http://www.codeproject.com/Articles/42227/Automatic-WPF-Toolkit-DataGrid-Filtering

我要做的是动态过滤我的DataGrid的每一列,但似乎DataTable不兼容或者其他东西,我得到NotSupportedException。来自DataGridFilterLibrary的QueryControllerFactory.cs的例外,if (view != null) view.Filter = null;的第26行。这是一个截图enter image description here任何想法?

0 个答案:

没有答案