1
私のアプリにポップアップを表示する必要があります。だから私はカスタマイズされたポップアップを作るためのユーザーコントロールを持っています。すべてのポップアップには、異なるメッセージと異なるボタンセットが表示されます。テキストを変更して新しいボタンを作成するために同じxamlを再利用することはできますか?または、別のユーザーコントロールを作成する必要がありますか?Windowsの実行時にユーザーコントロールの内容を変更することができます電話
<Grid Height="250" Width="480">
<Canvas Margin="0,0,0,0">
<Canvas.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="Black" Offset="0"/>
<GradientStop Color="#FF121111" Offset="1"/>
</LinearGradientBrush>
</Canvas.Background>
<Button Content="Buy" x:Name="buttonBuy" Click="btnBuyNow_Click" BorderThickness="0" Style="{StaticResource UserControlBuy}" MinWidth="96" MinHeight="98" FontFamily="{StaticResource CicleFina}" FontSize="18.667" Canvas.Left="189" Canvas.Top="141" Height="98" Width="96" Foreground="#FF0E0C0C">
<Button.Background>
<ImageBrush ImageSource="Images/02/but_bg_trial_buy.png"/>
</Button.Background>
</Button>
<TextBlock TextWrapping="Wrap" FontSize="21.333" Padding="10" Text="Your trial period is over. Please purchase the full version" Height="141" Width="479" Foreground="#D48394" FontFamily="{StaticResource PeaSnow}" TextAlignment="Center" d:LayoutOverrides="Width, Height"/>
</Canvas>
</Grid>
これは私がアプリでポップアップを呼び出した方法です。 。
Popup popup = new Popup();
BuyNowUserControl content = new BuyNowUserControl(popup);
// set the width of the popup to the width of the screen
content.Width = System.Windows.Application.Current.Host.Content.ActualWidth;
popup.Child = content;
popup.VerticalOffset = 300;
popup.IsOpen = true;
おかげ
Alfah
:Dありがとうございます! :D Phewはたくさんのように見える:D – alfah