Silverlight-popup
Silverlight-ポップアップ
このクラスは、アプリケーションウィンドウの境界内で、既存のコンテンツの上にコンテンツを表示します。 他のコンテンツに一時的に表示されます。 Popupクラスの階層的な継承は次のとおりです-
以下に示すのは、一般的に使用される Popup クラスの properties です。
以下に、Popupの最も一般的に使用されるプロパティを示します。
Sr. No. | Property & Description |
---|---|
1 |
Child ポップアップでホストされるコンテンツを取得または設定します。 |
2 |
ChildProperty Child依存プロパティの識別子を取得します。 |
3 |
ChildTransitions Popupの子コンテンツに適用されるTransitionスタイル要素のコレクションを取得または設定します。 |
4 |
ChildTransitionsProperty ChildTransitions依存プロパティを識別します。 |
5 |
HorizontalOffset アプリケーションウィンドウの左側とポップアップの左側の間の距離を取得または設定します。 |
6 |
HorizontalOffsetProperty HorizontalOffset依存プロパティの識別子を取得します。 |
7 |
IsLightDismissEnabled Popupを閉じる方法を決定する値を取得または設定します。 |
8 |
IsLightDismissEnabledProperty IsLightDismissEnabled依存プロパティを識別します。 |
9 |
IsOpen ポップアップが現在画面に表示されているかどうかを取得または設定します。 |
10 |
IsOpenProperty IsOpen依存プロパティの識別子を取得します。 |
11 |
VerticalOffset アプリケーションウィンドウの上部とポップアップの上部の間の距離を取得または設定します。 |
12 |
VerticalOffsetProperty VerticalOffset依存プロパティの識別子を取得します。 |
ポップアップクラスには、次の*イベント*があります。
Popupで最も一般的に使用されるイベントを以下に示します。
Sr. No. | Event & Description |
---|---|
1 |
Closed IsOpenプロパティがfalseに設定されたときに発生します。 |
2 |
Opened IsOpenプロパティがtrueに設定されたときに発生します。 |
以下に、PopupコントロールとCheckBoxが作成および初期化される簡単な例を示します。 ユーザーが CheckBox をチェックすると、 Popup が表示されます。
<UserControl x:Class = "Popup.MainPage"
xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x = "http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d = "http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc = "http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable = "d"
d:DesignHeight = "300" d:DesignWidth = "400">
<Grid x:Name = "LayoutRoot" Background = "White">
<CheckBox Name = "PCheckBox" Margin = "0,100,296,172" Content = "Checked Me"/>
<Popup IsOpen = "{Binding ElementName = PCheckBox,Path = IsChecked}">
<Canvas Width = "125" Height = "100" Background = "LightGray">
<Canvas.RenderTransform>
<RotateTransform x:Name = "theTransform"/>
</Canvas.RenderTransform>
<TextBlock TextWrapping = "Wrap" Foreground = "Blue" Text = "Hi,
this is Popup"/>
</Canvas>
</Popup>
</Grid>
</UserControl>
上記のコードをコンパイルして実行すると、次の出力が表示されます。 *チェックボックス*チェックボックスをオンにすると、ポップアップが表示されます。