<Window x:Class="Commands.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525" ResizeMode="CanResize" ShowInTaskbar="True">
<Window.CommandBindings>
<CommandBinding Command="Save" Executed="Save_Executed" CanExecute="Save_CanExecute"/>
<CommandBinding Command="Close" Executed="Close_Executed" CanExecute="Close_CanExecute"/>
</Window.CommandBindings> <Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="5"/>
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions> <!--Background="#00000000" 透明色设置-->
<Menu Grid.Row="0" Grid.ColumnSpan="3"> <MenuItem Header="保存" Command="Save"/>
<MenuItem Header="关闭" Command="Close"/>
</Menu> <ToolBar Grid.Row="1" Grid.ColumnSpan="3">
<Button>
<Image Source="image/Copy.png"/>
</Button>
<Button>
<Image Source="image/Paste.png"/>
</Button>
<Button>
<Image Source="image/Cut.png"/>
</Button>
<Button>
<Image Source="image/Delete.png"/>
</Button>
</ToolBar>
<TextBox Grid.Row="2" Name="txtLeft" TextChanged="txtLeft_TextChanged">
<TextBox.ContextMenu>
<ContextMenu>
<MenuItem Header="复制" >
<MenuItem.Icon>
<Image Source="/Commands;component/image/Copy.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="粘贴">
<MenuItem.Icon>
<Image Source="/Commands;component/image/Paste.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="剪贴">
<MenuItem.Icon>
<Image Source="/Commands;component/image/Cut.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="删除">
<MenuItem.Icon>
<Image Source="/Commands;component/image/Delete.png" />
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</TextBox.ContextMenu>
</TextBox>
<GridSplitter Grid.Row="2" Grid.Column="1" Width="5" Background="GhostWhite" HorizontalAlignment="Stretch" />
<TextBlock Grid.Column="2" Grid.Row="2" Name="txtRight" />
<StatusBar Grid.Row="3" Name="statusBar1" Grid.ColumnSpan="3" >
<StatusBarItem Content="当前状态为:" />
<Label Content="default"/>
</StatusBar>
</Grid>
</Window>