当前位置:编程学习 > C#/ASP.NET >>

十万火急!!!望大神指教

再做毕业设计,在WPF窗口中,用DataGrid显示数据列表,显示正常,但是DataGrid里面的行不能选中,不知道为什么。。。用snoop看了下,无论怎么点DataGridRow的IsSelected属性一直是false。。不知为何,求解啊! --------------------编程问答-------------------- 部分代码,供参考,纠结死了
<Style TargetType="{x:Type TextBlock}" x:Key="DataTextBoxStyle" BasedOn="{StaticResource {x:Type TextBlock}}">
            <Setter Property="FontSize" Value="14" />
            <Setter Property="Margin" Value="5,0" />
            <Setter Property="MinWidth" Value="50" />
        </Style>

<DataGrid x:Name="memberList" ItemsSource="{Binding MemberList,ElementName=m_self}" AutoGenerateColumns="False">
                            <DataGrid.Columns>
                                <DataGridTemplateColumn Header="姓名">
                                    <DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <TextBlock Text="{Binding Name}" Style="{StaticResource DataTextBoxStyle}"/>
                                        </DataTemplate>
                                    </DataGridTemplateColumn.CellTemplate>
                                </DataGridTemplateColumn>
                                <DataGridTemplateColumn MaxWidth="50" Header="性别">
                                    <DataGridTemplateColumn.CellTemplate>
                                        <DataTemplate>
                                            <TextBlock Text="{Binding Gender}" Style="{StaticResource DataTextBoxStyle}"/>
                                        </DataTemplate>
                                    </DataGridTemplateColumn.CellTemplate>
                                </DataGridTemplateColumn> --------------------编程问答-------------------- SelectionUnit="FullRow"
补充:.NET技术 ,  C#
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,