Inlining code within a XAML file

<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="" Height="300" Width="300">
<Button
Click="ButtonClickedHandler "
Name="MyButton"
Width="50 "
Content="Click Me! " />
<x:Code>
void ButtonClickedHandler(object sender, RoutedEventArgs eventArgs)
{
MyButton.Width = 100 ;
MyButton.Content = "Thank you! ";
}
</x:Code>
</Window>
Related examples in the same category