问题描述
我使用了提到的代码。当我试图选择一行时,它没有被选中。请告诉我我犯的错误。
< DataGrid Name =DG_FollowUpAutoGenerateColumns =FalseSelectionMode =SingleSelectedIndex =0HorizontalAlignment = StretchVerticalAlignment =StretchGrid.Column =0Grid.Row =01BorderBrush =BlackBorderThickness =0.5LoadingRow =DG_FollowUp_LoadingRowIsEnabled =TrueCanUserAddRows =false>
< datagrid.columns>
< DataGridTextColumn Binding ={Binding EntryID}Header =Entry IDWidth =75>
< datagridtextcolumn.elementstyle>
& lt; Setter Property =HorizontalAlignmentValue ='Center'/>
< DataGridTextColumn Binding ={Binding [TicketID / Subject ]}Header =TicketID / SubjectWidth =330CanUserSort =False/>
< DataGridTextColumn Binding ={Binding [AddDate]}Header =Start Date Width =90CanUserSort =False>
< DataGridTextColumn Binding ={Binding [Status]}Header =StatusWidth =130CanUserSort =False>
< DataGridTextColumn Binding ={Binding [OwnerShip]}Header =OwnershipWidth =130CanUserSort =False>
< DataGridTextColumn Binding ={Binding [Comments]}Header =CommentsWidth =300CanUserSort =False>
< DataGridTextColumn Binding ={Binding [SLA DATE]}Header = SLA DateWidth =90CanUserSort =False>
< DataGridCheckBoxColumn Header =Strike1Width =70CanUserSort =False>
< DataGridCheckBoxColumn Header =Strike2Width =70CanUserSort =Fals e>
< DataGridCheckBoxColumn Header =Strike3Width =70CanUserSort =False>
我通过从SQLDB读取数据绑定到上面的网格。
我尝试了什么:
i尝试使用IsEnabled =true,Selectionmode =Single以及给出selectedIndex = 0,它们都没有工作。
I used the blow mentioned code. When i am trying to select a row, its not getting selected. Please let me know the mistake i did.
<DataGrid Name="DG_FollowUp" AutoGenerateColumns="False" SelectionMode="Single" SelectedIndex="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Column="0" Grid.Row="01" BorderBrush="Black" BorderThickness="0.5" LoadingRow="DG_FollowUp_LoadingRow" IsEnabled="True" CanUserAddRows="false">
<datagrid.columns>
<DataGridTextColumn Binding="{Binding EntryID}" Header="Entry ID" Width="75">
<datagridtextcolumn.elementstyle>
<Setter Property="HorizontalAlignment" Value='Center'/>
<DataGridTextColumn Binding="{Binding [TicketID/Subject]}" Header="TicketID/Subject" Width="330" CanUserSort="False"/>
<DataGridTextColumn Binding="{Binding [AddDate]}" Header="Start Date" Width="90" CanUserSort="False">
<DataGridTextColumn Binding="{Binding [Status]}" Header="Status" Width="130" CanUserSort="False">
<DataGridTextColumn Binding="{Binding [OwnerShip]}" Header="Ownership" Width="130" CanUserSort="False">
<DataGridTextColumn Binding="{Binding [Comments]}" Header="Comments" Width="300" CanUserSort="False">
<DataGridTextColumn Binding="{Binding [SLA DATE]}" Header="SLA Date" Width="90" CanUserSort="False">
<DataGridCheckBoxColumn Header="Strike1" Width="70" CanUserSort="False">
<DataGridCheckBoxColumn Header="Strike2" Width="70" CanUserSort="False">
<DataGridCheckBoxColumn Header="Strike3" Width="70" CanUserSort="False">
I am binding data to the above grid by reading from SQLDB.
What I have tried:
i tried using IsEnabled= "true", Selectionmode="Single" and also with giving selectedIndex=0, None of them were working.
推荐答案
这篇关于Wpf DATAGRID未被选中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!