ฉันมีคำถามเกี่ยวกับ wpf datagrid ซึ่งเป็นพฤติกรรมของ DatagridTemplateColumn
<DataGrid
ItemsSource="{Binding Items, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
inf:MultiSelectorBehaviours.SynchronizedSelectedItems="{Binding SelectedItems, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
SelectionUnit="FullRow" SelectionMode="Extended">
<DataGrid.Columns>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Background="Transparent"
BorderThickness="0"
BorderBrush="Transparent"
Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.ExecuteCommand}" CommandParameter="{Binding}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
My Question is: When i press the button in DataGridTemplateColumn and the row is NOT selected, command is fired in my model. But when select my row first, command is not fired. Does anybody know why?
ขอบคุณสำหรับความช่วยเหลือของคุณ...
แก้ไข: เมื่อฉันเปลี่ยน SelectionMode จาก "Extensed" เป็น "Single" มันทำงานได้ตามที่คาดไว้ แต่ฉันต้องใช้ "ขยาย"...
<DataTemplate.Triggers>
และ<EventTrigger>
เพื่อสิ่งเดียวกัน ขณะนี้คุณกำลังจัดการเฉพาะการคลิกปุ่มและส่งคำสั่งเพื่อดูโมเดล คุณอาจต้องคลิกทั้งแถว - person ViVi   schedule 21.06.2016