Uwp-contentdialog-Custom Imitation iphone hint box, hint box beautify

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.