added samples
[windows-sources.git] / sdk / samples / WPFSamples / TextBox_ContextMenu / visualbasic / window1.xaml
blobf1fa666673cfe5b2c21bdfbf3e28a2fdc69da837
1 <Window x:Class="SDKSample.Window1"
2     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4     Title="TextBox Custom Context Menu"
5     Width="640" Height="480"
6     >
7     <Grid Name="myGrid">
8       <Grid.RowDefinitions>
9         <RowDefinition Height="40"/>
10         <RowDefinition/>
11       </Grid.RowDefinitions>
12       
13       <StackPanel 
14         Grid.Row="0"
15         HorizontalAlignment="Center"
16         VerticalAlignment="Center"
17         Orientation="Horizontal"
18       >
19         <RadioButton
20           Name="rbCustom" 
21           Padding="5,0,5,0"
22           IsChecked="True"
23           Checked="MenuChange"
24         >
25           Custom Context Menu
26         </RadioButton>
27         <RadioButton
28           Name="rbDefault" 
29           Padding="5,0,5,0"  
30           Checked="MenuChange"
31         >
32           Default Context Menu
33         </RadioButton>
34         <RadioButton
35           Name="rbDisabled" 
36           Padding="5,0,5,0"
37           Checked="MenuChange"
38         >
39           Disable Context Menu
40         </RadioButton>
41       </StackPanel>
43       <TextBox
44         Name="cxmTextBox" 
45         Grid.Row="1"
46         AcceptsReturn="True"
47         AcceptsTab="True"
48         VerticalScrollBarVisibility="Visible"
49         TextWrapping="Wrap"
50       >
51         <TextBox.ContextMenu>
52           <ContextMenu 
53             Name="cxm"
54             Opened="CxmOpened"
55           >
56             <MenuItem 
57               Header="Cut"
58               Name="cxmItemCut" 
59               Click="ClickCut" 
60             />
61             <MenuItem 
62               Header="Copy" 
63               Name="cxmItemCopy"
64               Click="ClickCopy" 
65             />
66             <MenuItem 
67               Header="Paste"
68               Name="cxmItemPaste"
69               Click="ClickPaste" 
70             />
71             <Separator/>
72             <MenuItem 
73               Header="Select All"
74               Name="cxmItemSelectAll"
75               Click="ClickSelectAll" 
76             />
77             <MenuItem 
78               Header="Select Current Line"
79               Name="cxmItemSelectLine"
80               Click="ClickSelectLine" 
81             />
82             <Separator/>
83             <MenuItem 
84               Header="Undo Last Action"
85               Name="cxmItemUndo"
86               Click="ClickUndo" 
87             />
88             <MenuItem 
89               Header="Redo Last Action"
90               Name="cxmItemRedo"
91               Click="ClickRedo" 
92             />
93             <Separator/>
94             <MenuItem 
95               Header="Clear All Text"
96               Name="cxmItemClear"
97               Click="ClickClear" 
98             />
99           </ContextMenu>
100         </TextBox.ContextMenu>
101         This TextBox uses a simple custom context menu.  The context menu can be disabled by checking
102         the CheckBox above, which simply sets the TextBox.ContextMenu property to null.
103       </TextBox>
104     </Grid>
105 </Window>