如何使用CheckBox按钮单击WPF网格控件获取选定行?

时间:2013-05-27 10:19:05

标签: c# wpf devexpress wpfdatagrid

我在CheckBox中有一个Column未绑定的GridControl。现在,它希望在Selected/Checked中获取Row Grid WPF控件,并将这些行插入另一个表格中。

XAML

<dxg:GridControl Name="grdInfill" Height="700" VerticalAlignment="Center">
    <dxg:GridControl.Columns>
        <dxg:GridColumn AllowEditing="True" FieldName="Dummy">
            <dxg:GridColumn.CellTemplate>
                <DataTemplate>
                    <CheckBox Name="chkSelect" HorizontalAlignment="Center" IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=DataContext.RowData.Row.GlassType}" Checked="CheckEdit_Checked" Unchecked="CheckEdit_Unchecked" />
                </DataTemplate>
            </dxg:GridColumn.CellTemplate>
        </dxg:GridColumn>
    <dxg:GridColumn FieldName="GlassType" AllowEditing="False">
</dxg:GridColumn>

    <dxg:GridControl.View>
        <dxg:TableView Name="grdInfillInner"  ShowTotalSummary="True" AutoWidth="True" DetailHeaderContent="True"  ShowIndicator="False" ShowGroupPanel="False" CellValueChanging="grdInfillInner_CellValueChanging"><!--GroupRowTemplate="{StaticResource descriptionHeader}"-->
        </dxg:TableView>
    </dxg:GridControl.View>
</dxg:GridControl>

Code

protected void GetAllInfills()
{
    List<Infill> infillList = new List<Infill>();
    infillList=BLL.GetAllInfills();

    if (infillList != null)
    {
        grdInfill.ItemsSource = infillList;
        grdInfill.GroupBy(grdInfill.Columns["Glass.GlassType"], ColumnSortOrder.Ascending);
        grdInfill.GroupBy(grdInfill.Columns["Glass.Glass_Description"], ColumnSortOrder.Ascending);
        grdInfill.AutoExpandAllGroups = true;
    }
}

如何在按钮上获取Seleted Row值!

0 个答案:

没有答案