I am reading a database file and based on the no. of entries output from the database to my query, I want to populate the buttons. And on clicking any of these buttons, I want to call an on click event for that entry in the database. How can I do that?
Template for Button:
<Window.Resources>
<ControlTemplate TargetType="Button" x:Key="RoundBtn">
<Border Name="roundBorder" CornerRadius="12.5" Height="25" Width="95" Margin="0" BorderBrush="Green" BorderThickness="0,0,0,0"
Background="Green">
<TextBlock Text="{TemplateBinding Content}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="12,0,13,0" Foreground="White"
/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="false">
<Setter TargetName="roundBorder" Property="Background" Value="Gray" />
<Setter TargetName="roundBorder" Property="BorderBrush" Value="Gray" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Window.Resources>
I need help in creating buttons and creating the on click event for calling it. I can handle the logic inside the on click event, but the problem is to identify which button was clicked on, so as to pass data for that particular button.