Skip to content

Commit 9dc9d6d

Browse files
author
Rukesh Shrestha
committed
checked in missing file MainWindows.xaml
1 parent 0b5c390 commit 9dc9d6d

3 files changed

Lines changed: 59 additions & 8 deletions

File tree

WpfXTestApp/MainWindow.xaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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>

WpfXTestApp/MainWindow.xaml.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
using System.Windows.Input;
1111
using System.Windows.Media;
1212
using System.Windows.Media.Imaging;
13-
using System.Windows.Navigation;
1413
using System.Windows.Shapes;
1514

1615
namespace WpfXTestApp

WpfXTestApp/WpfXTestApp.csproj

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,15 @@
5353
<Generator>MSBuild:Compile</Generator>
5454
<SubType>Designer</SubType>
5555
</ApplicationDefinition>
56-
<Page Include="MainWindow.xaml">
57-
<Generator>MSBuild:Compile</Generator>
58-
<SubType>Designer</SubType>
59-
</Page>
6056
<Compile Include="App.xaml.cs">
6157
<DependentUpon>App.xaml</DependentUpon>
6258
<SubType>Code</SubType>
6359
</Compile>
60+
</ItemGroup>
61+
<ItemGroup>
6462
<Compile Include="MainWindow.xaml.cs">
6563
<DependentUpon>MainWindow.xaml</DependentUpon>
66-
<SubType>Code</SubType>
6764
</Compile>
68-
</ItemGroup>
69-
<ItemGroup>
7065
<Compile Include="MainWindowViewModel.cs" />
7166
<Compile Include="Properties\AssemblyInfo.cs">
7267
<SubType>Code</SubType>
@@ -100,6 +95,12 @@
10095
<Name>WPFXCommand</Name>
10196
</ProjectReference>
10297
</ItemGroup>
98+
<ItemGroup>
99+
<Page Include="MainWindow.xaml">
100+
<SubType>Designer</SubType>
101+
<Generator>MSBuild:Compile</Generator>
102+
</Page>
103+
</ItemGroup>
103104
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
104105
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
105106
Other similar extension points exist, see Microsoft.Common.targets.

0 commit comments

Comments
 (0)