In order to achieve the effect I want to spend a long time, alas, the English is not easy to learn, turned over the official website for half a day to find, share to just get started novice.
First look at a picture example, we want to imitate the dialog is the long such:
Made out of:
Code
Xaml:
1<grid background="#3d4ba4">2 3<contentdialog x:name="Termsofusecontentdialog" 4Background="Transparent"Borderbrush="Transparent"5 6>7<grid cornerradius="8"Background=" White"Width="284"height="176">8<stackpanel margin="20,20,20,54">9<image source="Assets/moren_hashiqi_thumb.png"Stretch="None"/>Ten<grid height=" the"></Grid> One<textblock text="Wow ... What is your name?"Horizontalalignment="Center"Verticalalignment="Center"/> A<textblock text="Kudou Shinichi,programmer and"Verticalalignment="Center"Horizontalalignment="Center"/> -<textblock text="detective!"Verticalalignment="Center"Horizontalalignment="Center"/> -</StackPanel> the<stackpanel verticalalignment="Bottom"orientation="Horizontal"> -<border height=" -"Width="142"Borderbrush="#efefef"borderthickness="0,1,0,0"> -<textblock text="Iknorite"Horizontalalignment="Center"Verticalalignment="Center"/> -</Border> +<border height=" -"Width="142"Borderbrush="#efefef"borderthickness="1,1,0,0"> -<textblock text="wait,what?"Foreground="#2d7abb"Horizontalalignment="Center"Verticalalignment="Center"/> +</Border> A</StackPanel> at</Grid> - -</ContentDialog> - - -<grid verticalalignment="Bottom"> in<button click="Button_Click"X:name="Button"Content="Button"Horizontalalignment=" Left"margin="36,35,0,0"Verticalalignment="Top"/> -</Grid> to + - the</Grid>
foreground XAML Code
There is no code in the background for an event listener:
1 Private Async void Button_Click (object sender, RoutedEventArgs e)2 {3 // popup Prompt box 4 await Termsofusecontentdialog.showasync (); 5 6 }
Background Code
"Little Notes"
Custom Contentdialog on page pages cannot be used this way:
Public MainPage () {this . InitializeComponent (); await Termsofusecontentdialog.showasync (); "Will error" //test (); "Error" } public async void Test () { / /await Termsofusecontentdialog.showasync (); "Will Error" }
But it can be used like this:
1 PublicMainPage ()2 {3 This. InitializeComponent ();4Test ();//OK5 }6 7 Public Async voidTest ()8 {9Contentdialog Content_dialog =NewContentdialog ()Ten { OneTitle ="Exit", AContent ="Kudoushinichi", -Primarybuttontext ="Determine", -Secondarybuttontext ="Cancel", thefullsizedesired =false, - }; - -Content_dialog. Primarybuttonclick + = (_s, _e) = { }; + - awaitContent_dialog. Showasync (); +}
Uwp-contentdialog-Custom Imitation iphone hint box, hint box beautify