|
| 1 | +<Window x:Class="WpfXTestApp.MainWindow" |
| 2 | + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| 3 | + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 4 | + xmlns:XCmd="clr-namespace:WPFXCommand;assembly=WPFXCommand" |
| 5 | + Title="MainWindow" Height="600" Width="900"> |
| 6 | + <Grid > |
| 7 | + <Grid.RowDefinitions> |
| 8 | + <RowDefinition Height="250"/> |
| 9 | + <RowDefinition Height="*"/> |
| 10 | + </Grid.RowDefinitions> |
| 11 | + <TextBlock TextAlignment="Center" |
| 12 | + Margin="50" |
| 13 | + FontFamily="Segoe UI Symbol" |
| 14 | + TextWrapping="Wrap" |
| 15 | + FontSize="18"> |
| 16 | + This is a simple app to demonstrate how you can utilize XCommand libarary to perform Command and CommandParameter binding on most of the routedevents provided on UIElement level. Currently supported routed events are listed on readme page. This libary provides very easy and convinent way of routed event Command/CommandParameter binding with any UI element without need to understand and remember any kind of naming convention. For example to bind on MouseMove, MouseMove.Command / MouseMove.CommandParameter is good to go for any UI element. |
| 17 | + </TextBlock> |
| 18 | + <Grid Grid.Row="1"> |
| 19 | + <Grid.ColumnDefinitions> |
| 20 | + <ColumnDefinition Width="300"></ColumnDefinition> |
| 21 | + <ColumnDefinition Width="*"></ColumnDefinition> |
| 22 | + </Grid.ColumnDefinitions> |
| 23 | + <TextBlock Margin="20,30,20,0" VerticalAlignment="Top" Height="80" x:Name="XTextBlock" |
| 24 | + TextTrimming="WordEllipsis" |
| 25 | + FontFamily="Segoe UI Symbol" |
| 26 | + TextWrapping="Wrap" |
| 27 | + FontSize="20" |
| 28 | + Foreground="{Binding FgColor, Mode=TwoWay}" |
| 29 | + XCmd:MouseMove.Command="{Binding TextBlockPointerMovedCommand}" |
| 30 | + XCmd:MouseLeftButtonDown.Command="{Binding TextBlockPointerPressedCommand}" |
| 31 | + XCmd:MouseLeave.Command="{Binding TextBlockPointerExitedCommand}" |
| 32 | + Text="{Binding Description, Mode=TwoWay}"></TextBlock> |
| 33 | + <Grid Grid.Column="1" Background="{Binding BgColor, Mode=TwoWay}" |
| 34 | + XCmd:MouseMove.Command="{Binding GridPointerMovedCommand}" |
| 35 | + XCmd:MouseMove.CommandParameter="{Binding ElementName=XTextBlock, Path=Text}" |
| 36 | + XCmd:MouseLeftButtonDown.Command="{Binding GridPointerPressedCommand}" |
| 37 | + XCmd:MouseLeftButtonDown.CommandParameter="{Binding ElementName=XTextBlock, Path=Text}" |
| 38 | + XCmd:MouseLeftButtonUp.Command="{Binding GridPointerReleasedCommand}" |
| 39 | + XCmd:MouseLeftButtonUp.CommandParameter="{Binding ElementName=XTextBlock, Path=Text}" |
| 40 | + XCmd:MouseLeave.Command="{Binding GridPointerExitedCommand}" |
| 41 | + XCmd:MouseLeave.CommandParameter="{Binding ElementName=XTextBlock, Path=Text}" |
| 42 | + > |
| 43 | + <TextBlock TextTrimming="WordEllipsis" Foreground="Black" |
| 44 | + FontFamily="Segoe UI Symbol" |
| 45 | + TextWrapping="Wrap" |
| 46 | + FontSize="30" |
| 47 | + Text="{Binding GridDescription, Mode=TwoWay}"></TextBlock> |
| 48 | + </Grid> |
| 49 | + </Grid> |
| 50 | + </Grid> |
| 51 | +</Window> |
0 commit comments