Partial Methods in C# v3 and VB9

kriz, thanks for watching.
Cheers
Daniel
First THIS WAS great and addressed almost everything I needed.
I have an issue and dont know how to address it and it was not addressed in the video.
I hope you or someone can help.
I placed a UserControl onto my WinForm some of the Xaml is below. If you notice in my user control
there is a PlusButton_Click how do I attach that to the main form?
Or how to alter the Winform to be able to handle a click event on the controls? How do I forward this? Its a custom control.
<UserControl1>
........
<Grid>
<Slider Name="slider1" Width="21" Orientation="Vertical" TickFrequency="1" Maximum="5" TickPlacement="None" IsSnapToTickEnabled="True" Value="0" HorizontalAlignment="Left" Margin="1,23,0,17" />
<Button x:Name="PlusButton" HorizontalAlignment="Left" VerticalAlignment="Top" Width="25"
Content="+" Height="37" Style="{StaticResource NewUpButton}" Background="#FF1C96FF"
FontWeight="Black" FontFamily="Arial" FontSize="16"
Click="PlusButton_Click" />
</Grid>
</UserControl1>
HELP?!
Hi ChicagoBob
Glad the video was useful. May I suggest that you use the free online forums for WPF questions please:
https://social.msdn.microsoft.com/Forums/en-US/wpf/threads
Good luck!
Cheers
Daniel
Hey ChicoBob
I don't know if you got it figured out yet, but here's my suggestion:
In the XAML code behind:
Public Event RemindClick As EventHandler Public Event DismissClick As EventHandler Private Sub dismiss_button_Click(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles dismiss_button.Click RaiseEvent DismissClick(Me, e) End Sub Private Sub remind_button_Click(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles remind_button.Click RaiseEvent RemindClick(Me, e) End Sub
Here you're creating 2 event handlers and then raising them on the click event.
In the code behind on the Windows Form:
Dim WithEvents WpfControl As WpfControlLibrary.WpfControl= Nothing ' In the form OnLoad event WpfControl = New WpfControlLibrary.WpfControl ElementHost1.Child = WpfControl Private Sub OkClick(ByVal sender As Object, ByVal e As EventArgs) Handles WpfControl.RemindClick ' Some code here End Sub Private Sub CancelClick() Handles WpfControl.DismissClick ' Some code here End Sub
Hope that helps...