I have to admit that I have problems understanding how wpf works. I have a usercontrol BottomControl nested in my Mainwindow . If a button is pressed in BottomControl, I want certain changes to occur in my Mainwindow (for example, changing the contents of a text field).
The easiest way to do this is to simply call a public procedure in Click_Event, but it is not very elegant. I got to using RoutedCommands.
public static readonly RoutedCommand BottomGridReSize = new RoutedCommand();
In XAML Usercontrol
<Button Style="{StaticResource TransparentButton}" Command="{x:Static local:Commands.BottomGridReSize}" >
In MainWindow Code
void BottomGridReSize_CanExecute(object sender, CanExecuteRoutedEventArgs e)
{
e.CanExecute = true;
}
void BottomGridReSize_Executed(object sender, ExecutedRoutedEventArgs e)
{
\\Do some stuff
}
Obviously, Mainwindow cannot use these events because ist does not recognize them. What am I missing?
Any help would be much appreciated
John