简体   繁体   English

如何通过Visual C#2010和WPF中的datagrid对象访问DataGrid.RowHeaderTemplate中的复选框?

[英]How to get access of a checkbox in a DataGrid.RowHeaderTemplate through datagrid object in Visual C# 2010 & WPF?

here is the portion of XAML --> 这是XAML的一部分->

        </Grid>
    </GroupBox>
    <TextBox Height="32" HorizontalAlignment="Right" Margin="0,417,256,0" Name="txtReason" VerticalAlignment="Top" Width="420" />
    <Label Content="Reason for release" HorizontalAlignment="Left" Margin="32,417,0,0" Name="label1" VerticalAlignment="Top" UseLayoutRounding="True" Width="109" />
    <Button Content="Remove" Height="23" HorizontalAlignment="Left" Margin="578,426,0,0" Name="btnRemove" VerticalAlignment="Top" Width="75" />
    <Label Content="No. of Users'" Height="28" HorizontalAlignment="Left" Margin="664,64,0,0" Name="label2" VerticalAlignment="Top" Width="83" />
    <Label Height="28" HorizontalAlignment="Left" Margin="744,64,0,0" Name="lblTotalUser" VerticalAlignment="Top" Width="72" />
    <Button Content="Count" Height="23" HorizontalAlignment="Left" Margin="666,151,0,0" Name="button1" VerticalAlignment="Top" Width="75" Click="button1_Click" />
</Grid>

I need to acess the dgCheck CheckBox through dgOnlineUsers datagrid? 我需要通过dgOnlineUsers datagrid访问dgCheck CheckBox吗?

I am not sure why, but i cannot seem to add a comment to your question... 我不确定为什么,但是我似乎无法在您的问题上添加评论...

My first question would be if you can post the XAML with the datagrid in it? 我的第一个问题是,是否可以使用数据网格发布XAML?

Second question: Why do you want to have (direct) access to your checkbox? 第二个问题:为什么要(直接)访问复选框? most of the things I can think of are achievable using binding and a good implementation of a viewmodel. 我可以想到的大多数事情都可以通过绑定和视图模型的良好实现来实现。 Can you elaborate on that? 您能详细说明一下吗?

Regards, Perry 问候,佩里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM