To demonstrate the usage of the event, we will add two buttons inside our ColorMixer User Control and expose the OK and Cancel button events from it. To implement the same, perform the following steps:
- Open the ColorMixer.xaml file and add the following StackPanel inside the Grid, which will place it at row index 1 and column index 0. The panel consists of two buttons with labels OK and Cancel:
<StackPanel Orientation="Horizontal" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Margin="4 10 4 4" HorizontalAlignment="Right"> <Button Content="OK" Margin="4" Width="50" Click="OnOkClicked"/> <Button Content="Cancel" Margin="4" Width="50" Click="OnCancelClicked"/> </StackPanel>
- Open the ColorMixer.xaml.cs file and register...