added samples
[windows-sources.git] / sdk / samples / WPFSamples / PopupPlacement / visualbasic / window1.xaml
blob01cd59be73ae9df6b96a21caa9ad1c51fb270a19
1 <Window x:Class="Window1"
2     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4     xmlns:src="clr-namespace:PopupPlacement"
5     Height="500" 
6     Title="PopupPlacement" 
7     Name="PopupApp"
8     >
9   <DockPanel>
10     <ToolBarTray DockPanel.Dock="Top">
11       <ToolBar Band="1"
12                RadioButton.Click="setPlacement">
13         <RadioButton Name="placementBottom" IsChecked="True">
14           <AccessText>_Bottom</AccessText>
15         </RadioButton>
16         <Separator/>
17         <RadioButton Name="placementTop">
18           <AccessText>_Top</AccessText>
19         </RadioButton>
20         <Separator/>
21         <RadioButton Name="placementLeft">
22           <AccessText>_Left</AccessText>
23         </RadioButton>
24         <Separator/>
25         <RadioButton Name="placementRight">
26           <AccessText>_Right</AccessText>
27         </RadioButton>
28         <Separator/>
29         <RadioButton Name="placementCenter">
30           <AccessText>_Center</AccessText>
31         </RadioButton>
32         <Separator/>
33         <RadioButton  Name="placementCustom">
34           <AccessText>C_ustom</AccessText>
35         </RadioButton>
36         <Separator/>
37         <RadioButton Name="placementAbsolute">
38           <AccessText>_Absolute</AccessText>
39         </RadioButton>
40         <Separator/>
41         <RadioButton Name="placementRelative">
42           <AccessText>Relati_ve</AccessText>
43         </RadioButton>
44         <Separator/>
45         <RadioButton Name="placementMouse">
46           <AccessText>_Mouse</AccessText>
47         </RadioButton>
48         <Separator/>
49         <RadioButton Name="placementAbsolutePoint">
50           <AccessText>Absolut_ePoint</AccessText>
51         </RadioButton>
52         <Separator/>
53         <RadioButton Name="placementRelativePoint">
54           <AccessText>RelativePoi_nt</AccessText>
55         </RadioButton>
56         <Separator/>
57         <RadioButton Name="placementMousePoint">
58           <AccessText>Mouse_Point</AccessText>
59         </RadioButton>
60       </ToolBar>
61       <ToolBar Band="2" BandIndex="2">
62         <ToggleButton Name="popupOpen" IsChecked="False">
63           <AccessText>_Show Popup</AccessText>
64         </ToggleButton>
65         <Separator/>
66         <ToggleButton Checked="showPlacementRectangle"
67                       Unchecked="hidePlacementRectangle">
68           <AccessText>Use PlacementRectan_gle</AccessText>
69         </ToggleButton>
70       </ToolBar>
71       <ToolBar Band="3" BandIndex="2">
72         <src:NumericUpDownControl x:Name="HOffset"  
73                     IncreaseButtonContent="Increase _Horizontal Offset"
74                     DecreaseButtonContent="Decrease H_orizontal Offset"/>
75         <src:NumericUpDownControl x:Name="VOffset"  
76                     IncreaseButtonContent="_Increase Vertical Offset"
77                     DecreaseButtonContent="_Decrease Vertical Offset"/>
79         <Button Click="resetOffsets_Click">
80           <AccessText>Reset O_ffsets</AccessText>
81         </Button>
82       </ToolBar>
83     </ToolBarTray>
84     <Canvas Background="Red" Name="canvas1">
85       <TextBlock FontSize="14" TextWrapping="Wrap" Width="{Binding ElementName=canvas1, Path=ActualWidth}">
86         Popup Placement Sample<LineBreak/>
87         <LineBreak/>
88         This sample demontrates how to position a popup.  Experiment with setting
89         thee popup to different PlacementMode values, setting HorizontalOffset
90         and VerticalOffset, switching between using and not using PlacementRectangle.
92       </TextBlock>
93       <Rectangle Name="placementRectArea" Visibility="Hidden"
94                  Canvas.Top="150" Canvas.Left="50"
95                  Height="90" Width="60" 
96                  StrokeThickness="1" Stroke="Black">
97       </Rectangle>
99       <Popup Name="popup1" Placement="Bottom" AllowsTransparency="True"
100              IsOpen="{Binding ElementName=popupOpen, Path=IsChecked}"
101              HorizontalOffset="{Binding ElementName=HOffset, Path=Value, Mode=TwoWay}"
102              VerticalOffset="{Binding ElementName=VOffset, Path=Value, Mode=TwoWay}"
103                >
104         <Grid Background="Blue" Opacity=".75" >
105           <TextBlock Margin="10"  FontSize="18"
106                      FontFamily="Constantia">
107             This is a Popup
108           </TextBlock>
109         </Grid>
110       </Popup>
111     </Canvas>
112   </DockPanel>
113 </Window>