"Miles Journey--windows App development" preview with flyout

Source: Internet
Author: User

In the previous learning of the control, we have seen the messagedialog, about button There is a flyout flyout oh. How exactly is it used? Let's take a look at the next.

We're going to continue with the previous example, okay, so the code comes.

        <button x:name="Btnwhat" Content="What is this?" ">            <button.flyout>                <flyout>                    <StackPanel>                        <TextBlock Width="430" Style="{StaticResource Basetextblockstyle}"  Text="Oh! You just stepped on the mine again, you want to undo it? " Foreground=" Red " FontSize="/>                                    "                        <button click="Btnundo_click" Margin="  Content="undo"/>                    </StackPanel>                </flyout>            </button.flyout>        </Button>

When we click on the Undo button, of course, the need to Btnwhat button flyout disappear, this is, as long as 1 lines of code. In addition this step thunder logic here does not unfold, in the future there might be related to the actual combat yo.

privatevoidbtnUndo_Click(object sender, RoutedEventArgs e){     btnWhat.Flyout.Hide();}

What is more important is that these are common in WP8, and that is the core. ^_^ Since this blog is primarily a flyout, wouldn't it be great if you could use the flyout to create a preview image? Let's start with a run.

Here are the code, what binding ah and so do not care. The important thing to note is that height and width may need to be adjusted.

<Page.Resources> <flyout x:key="Resourceflyoutimage"Placement="Right"> <ImageSource="{Binding Path=source}"maxheight=" the"Maxwidth="1400"Stretch="Uniform"/> <Flyout.FlyoutPresenterStyle> <StyleTargettype="Flyoutpresenter"> <Setter  Property="MinHeight" Value=" the"/> <Setter  Property="MinWidth"  Value=" the"/> <Setter  Property="BorderThickness" Value="3"/> <Setter  Property="Background" Value="Wheat"/> <Setter  Property="BorderBrush" Value="Green"/> <Setter  Property="Scrollviewer.zoommode" Value="Enabled"/> </Style> </Flyout.FlyoutPresenterStyle> </Flyout> </Page.Resources> <Grid> <stackpanel horizontalalignment="left"orientation="Vertical"> <ImageSource="Assets/14152.jpg"Width=" the"height=" the"margin=" A"Tapped="img_tapped"flyoutbase.attachedflyout="{StaticResource resourceflyoutimage}"datacontext="{Binding relativesource={relativesource Mode=self}}"/> <ImageSource="Assets/14158.jpg"Width=" the"height=" the"margin=" A"Tapped="img_tapped"flyoutbase.attachedflyout="{StaticResource resourceflyoutimage}"datacontext="{Binding relativesource={relativesource Mode=self}}"/> <ImageSource="Assets/14160.jpg"Width=" the"height=" the"margin=" A"Tapped="img_tapped"flyoutbase.attachedflyout="{StaticResource resourceflyoutimage}"datacontext="{Binding relativesource={relativesource Mode=self}}"/> <ImageSource="Assets/14164.jpg"Width=" the"height=" the"margin=" A"Tapped="img_tapped"flyoutbase.attachedflyout="{StaticResource resourceflyoutimage}"datacontext="{Binding relativesource={relativesource Mode=self}}"/> </StackPanel> </Grid>
privatevoidimg_Tapped(object sender, TappedRoutedEventArgs e){    FlyoutBase.ShowAttachedFlyout((FrameworkElement)sender);}             

In the same way, on the WP also can get oh, a bit is to do some modified XAML code. As you can see, I have narrowed down the picture, and the placement has also been set to Top,stactpanel's properties have also been modified.

<Page.Resources> <flyout x:key="Resourceflyoutimage"Placement="Top"> <ImageSource="{Binding Path=source}"maxheight=" the"Maxwidth=" the"Stretch="Uniform"/> <Flyout.FlyoutPresenterStyle> <StyleTargettype="Flyoutpresenter"> <Setter  Property="MinHeight" Value=" the"/> <Setter  Property="MinWidth"  Value=" the"/> <Setter  Property="BorderThickness" Value="3"/> <Setter  Property="Background" Value="Wheat"/> <Setter  Property="BorderBrush" Value="Green"/> <Setter  Property="Scrollviewer.zoommode" Value="Enabled"/> </Style> </Flyout.FlyoutPresenterStyle> </Flyout> </Page.Resources> <Grid> <stackpanel verticalalignment="Bottom"orientation="Horizontal"> <ImageSource="Assets/14152.jpg"Width=" the"height=" the"margin=" A"Tapped="img_tapped"flyoutbase.attachedflyout="{StaticResource resourceflyoutimage}"datacontext="{Binding relativesource={relativesource Mode=self}}"/> <ImageSource="Assets/14158.jpg"Width=" the"height=" the"margin=" A"Tapped="img_tapped"flyoutbase.attachedflyout="{StaticResource resourceflyoutimage}"datacontext="{Binding relativesource={relativesource Mode=self}}"/> <ImageSource="Assets/14160.jpg"Width=" the"height=" the"margin=" A"Tapped="img_tapped"flyoutbase.attachedflyout="{StaticResource resourceflyoutimage}"datacontext="{Binding relativesource={relativesource Mode=self}}"/> <ImageSource="Assets/14164.jpg"Width=" the"height=" the"margin=" A"Tapped="img_tapped"flyoutbase.attachedflyout="{StaticResource resourceflyoutimage}"datacontext="{Binding relativesource={relativesource Mode=self}}"/> </StackPanel> </Grid>

The effect is still very good oh! (With the 638 ... The resolution is poor, the small partners should have been found in the code already. Say this preview of the picture is not a jump out of the oh, but into a number of parts, slowly come out, the effect, like the blinds. (Use the traffic to see this blog's Children's shoes, I also cut a number of times to cut out the effect of the figure.) )

So this blog post so far, I hope you learn happy. Goodbye to the next article!

"Miles Journey--windows App development" preview with flyout

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.