Search code examples
silverlightxamldatagriddatatemplateeventtrigger

Using buttons in DataTemplate for DataGrid for Action


Ok so here's what I got, as example.

<sdk:DataGridTemplateColumn>
  <sdk:DataGridTemplateColumn.CellTemplate>
    <DataTemplate>
      <HyperlinkButton Content="Delete" Visibility="{Binding Priority, Converter={StaticResource FDPriorityToVisibilityConverter}}" >
        <i:Interaction.Triggers>
          <i:EventTrigger EventName="Click">
           <cal:ActionMessage MethodName="DeleteRule">
             <cal:Parameter Value="{Binding Id}"/>
           </cal:ActionMessage>
          </i:EventTrigger>
        </i:Interaction.Triggers>
       </HyperlinkButton>
    </DataTemplate>
  </sdk:DataGridTemplateColumn.CellTemplate>
</sdk:DataGridTemplateColumn>

What I want to do is replace the HyperlinkButton control with a Button (Essentially just deleting "Hyperlink" from the tag ), but it doesnt respect the eventtrigger when I do that. So when clicked it just doesnt do anything. I figured I could maybe solve this with replacing cal:ActionMessage with EventToCommand but I must not be implementing correctly.

Short version of question, can someone shed some light on how I can get the functionality the existing HyperlinkButton accomplishes, but with a button control so I can give it an icon instead of just text that says Delete? Thanks for any insight!


Solution

  • For answer read my comment made, I believe this issue is circumstantial and a workaround was deliberated.