|
| 1 | +<Window x:Class="Popup_Properties_Sample.Window1" |
| 2 | + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| 3 | + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 4 | + Title="Popup_Properties_Sample" |
| 5 | + > |
| 6 | + <StackPanel> |
| 7 | + <Border HorizontalAlignment="Left" BorderThickness="2" Margin="10,10,0,0" |
| 8 | + BorderBrush="Green" Background="Beige" Width="300"> |
| 9 | + <TextBlock Foreground="Blue" FontSize="12" Margin="10,10,10,10" |
| 10 | + TextWrapping="Wrap" > |
| 11 | + This sample shows examples of a Popup controls |
| 12 | + that are the logical children of a Buttons. Each Popup |
| 13 | + window is positioned with respect to a Button. However, |
| 14 | + because the Popup content is contained in its own window, |
| 15 | + the Popup is not a visual child of the Button. |
| 16 | + </TextBlock> |
| 17 | + </Border> |
| 18 | + <TextBlock/> |
| 19 | + <TextBlock Foreground="Blue" FontSize="12" Margin="20,10,10,10" |
| 20 | + TextWrapping="Wrap" Width="300" HorizontalAlignment="Left"> |
| 21 | + Type the content you want to appear in the Popup in the text |
| 22 | + box below and then click the button to display the Popup |
| 23 | + </TextBlock> |
| 24 | + <TextBox Name="myTextBox" Margin="20,0,0,0" Foreground="HotPink" |
| 25 | + Width="150" HorizontalAlignment="Left" TextChanged="setColors"> |
| 26 | + Type your Popup text here |
| 27 | + </TextBox> |
| 28 | + <!--<ToggleButtonCodeless>--> |
| 29 | + <ToggleButton x:Name="TogglePopupButton" Height="30" Width="150" HorizontalAlignment="Left"> |
| 30 | + <StackPanel> |
| 31 | + <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center"> |
| 32 | + <Run Text="Is button toggled? " /> |
| 33 | + <Run Text="{Binding IsChecked, ElementName=TogglePopupButton}" /> |
| 34 | + </TextBlock> |
| 35 | + |
| 36 | + <Popup Name="myPopup" IsOpen="{Binding IsChecked, ElementName=TogglePopupButton}"> |
| 37 | + <Border BorderThickness="1"> |
| 38 | + <TextBlock Name="myPopupText" Background="LightBlue" Foreground="Blue" Padding="30"> |
| 39 | + Popup Text |
| 40 | + </TextBlock> |
| 41 | + </Border> |
| 42 | + </Popup> |
| 43 | + </StackPanel> |
| 44 | + </ToggleButton> |
| 45 | + <!--</ToggleButtonCodeless>--> |
| 46 | + |
| 47 | + <TextBlock Foreground="Blue" FontSize="12" Margin="10,40,10,0" |
| 48 | + TextWrapping="Wrap"> |
| 49 | + Click the button to create a Popup by using code |
| 50 | + </TextBlock> |
| 51 | + <!--<SnippetCreatePopupCodeXAML>--> |
| 52 | + <Button HorizontalAlignment="Left" Click="CreatePopup" |
| 53 | + Width="150" Margin="20,10,0,0"> |
| 54 | + <StackPanel Name="ButtonContentContainer"> |
| 55 | + <TextBlock>Create Popup</TextBlock> |
| 56 | + </StackPanel> |
| 57 | + </Button> |
| 58 | + <!--</SnippetCreatePopupCodeXAML>--> |
| 59 | + |
| 60 | + |
| 61 | + |
| 62 | + |
| 63 | + </StackPanel> |
| 64 | +</Window> |
0 commit comments