silverlight   发布时间:2022-05-04  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了PopUp.xaml_1130大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

前台 <UserControl x:Class="SilverlightProjectTry.PopUp"     xmlns="http://scheR_224_11845@as.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://scheR_224_11845@as.microsoft.com/winfx/2006/xaml"     xmlns:d="http

前台

<UserControl x:Class="SilverlightProjectTry.PopUp"
    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="600" d:DesignWidth="800">

    <UserControl.resources>
        <Storyboard x:Name="Storyboard1">
            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="userControl" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.AnglE)">
                <SplineDoubleKeyFrame KeyTime="00:00:00" Value="-14.881999969482422"/>
                <SplineDoubleKeyFrame KeyTime="00:00:01" Value="0"/>
            </DoubleAnimationUsingKeyFrames>
        </Storyboard>
    </UserControl.resources>
    <Grid x:Name="LayoutRoot" BACkground="#FFBDC8C9">
        <StackPanel>
            <TextBlock Height="26"  VerticalAlignment="Bottom" Text="" textwrapping="Wrap" x:Name="messageText" HorizontalAlignment="Left" Width="158"/>
            <TextBlock Height="26" HorizontalAlignment="Left"  VerticalAlignment="Top" Width="164" Text="Silverlight弹出窗口示例" textwrapping="Wrap"/>
            <Button Height="40" HorizontalAlignment="Left"  x:Name="OpenBox" VerticalAlignment="Top" Width="100" Content="弹出窗口" Click="OpenBox_Click"/>
            <Button HorizontalAlignment="Left" x:Name="OpenModalBox" Width="100" Content="弹出模式窗口" Height="40" Click="OpenModalBox_Click"/>
            <Button Height="40" x:Name="Openmessage" VerticalAlignment="Top" Content="弹出消息" Width="100" HorizontalAlignment="Right" Click="Openmessage_Click"/>
            <Button  x:Name="OpenModalmessage" Content="弹出模式消息" HorizontalAlignment="Right" Width="100" Height="40" d:LayoutOverrides="Height" VerticalAlignment="Top" Click="OpenModalmessage_Click"/>
            <Rectangle  Fill="#FFFFFFFF" stroke="#FF000000" strokeThickness="2"/>
            <TextBlock Height="Auto" HorizontalAlignment="Left"  VerticalAlignment="Top" Width="Auto" RenderTransformOrigin="0.32,1.087" Text="消息框设置" textwrapping="Wrap" d:LayoutOverrides="Height"/>
            <TextBlock Height="17" HorizontalAlignment="Left"  VerticalAlignment="Top" Width="Auto" Text="标题:" textwrapping="Wrap"/>
            <TextBlock Height="17"  VerticalAlignment="Top" Width="Auto" textwrapping="Wrap" d:LayoutOverrides="Width"><Run Text="内容"/><Run Text=":"/></TextBlock>
            <TextBox Height="Auto" HorizontalAlignment="Left"  VerticalAlignment="Top" Width="108" Text="填写标题" textwrapping="Wrap" x:Name="title" d:LayoutOverrides="Height"/>
            <TextBox Height="Auto"  VerticalAlignment="Top" Text="填写内容" textwrapping="Wrap" HorizontalAlignment="Left" Width="108" x:Name="message" d:LayoutOverrides="Height"/>
            <TextBlock Height="18" HorizontalAlignment="Left"  VerticalAlignment="Top" Width="Auto" Text="按钮:" textwrapping="Wrap"/>
            <ComboBox Height="Auto" HorizontalAlignment="Left"  VerticalAlignment="Top" Width="108" x:Name="ButtonType" d:LayoutOverrides="Height">
                <ComboBoxItem Tag="Yesno" Content="Yes/No" IsSELEcted="True"/>
                <ComboBoxItem Tag="YesnoCancle" Content="Yes/No/Cancle"/>
                <ComboBoxItem Tag="OkCancle" Content="Ok/Cancle"/>
                <ComboBoxItem Tag="RetryAbort" ToolTipservice.ToolTip="" Content="Retry/Abort"/>
                <ComboBoxItem Tag="RetryAbortCancle" ToolTipservice.ToolTip="" Content="Retry/Abort/Cancle"/>
            </ComboBox>
            <TextBlock Height="18" VerticalAlignment="Top" Width="Auto" textwrapping="Wrap" d:LayoutOverrides="Width"><Run Text="特效"/><Run Text=":"/></TextBlock>
            <ComboBox Height="Auto"  VerticalAlignment="Top" HorizontalAlignment="Left" Width="108" x:Name="Effects" d:LayoutOverrides="Height">
                <ComboBoxItem Tag="NoEffect" Content="无特效" IsSELEcted="True"/>
                <ComboBoxItem Tag="Fade" Content="渐隐"/>
                <ComboBoxItem Tag="Zoom" Content="缩放"/>
            </ComboBox>
            <TextBlock  Width="Auto" textwrapping="Wrap" Height="18" VerticalAlignment="Top" Text="图标:" d:LayoutOverrides="Width"/>
            <ComboBox Height="Auto"  x:Name="Icon" VerticalAlignment="Top" HorizontalAlignment="Left" Width="108">
                <ComboBoxItem Tag="No" Content="无图标" IsSELEcted="True"/>
                <ComboBoxItem Tag="Caution" Content="警告"/>
                <ComboBoxItem Tag="Error" Content="错误"/>
                <ComboBoxItem Tag="Caution" Content="提示"/>
                <ComboBoxItem Tag="Information" Content="信息"/>
                <ComboBoxItem Tag="Question" Content="询问"/>
            </ComboBox>
        </StackPanel>
    </Grid>
</UserControl>

后台

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using GDev.PopupBox;
using SilverlightApplication1;

namespace SilverlightProjectTry
{
    public partial class PopUp : UserControl
    {
        public PopUp()
        {
            InitializeComponent();
        }
        private Effect GetEffect(FrameworkElement target)
        {
            switch ((String)((ComboBoxItem)Effects.SELEctedItem).Tag)
            {
                case "NoEffect":
                    return GDev.PopupBox.Effect.NoEffect(target);
                case "Fade":
                    return GDev.PopupBox.Effect.Fade(target);
                case "Zoom":
                    return GDev.PopupBox.Effect.Zoom(target);
                default:
                    return GDev.PopupBox.Effect.NoEffect(target);
            }

        }

        private void OpenBox_Click(object sender,RoutedEventArgs E)
        {
            Popupservice service = Popupservice.GetserviceFor(LayoutRoot);
            BoxPage Box = service.GetBoxPage(
                new MyControl(),//显示的控件
                title.Text,//标题
                true,//是否可以拖动
                true //是否显示关闭图标
            );
            Box.Effect = GetEffect(Box);
            Box.ShowComplete += new EventHandler(Box_ShowCompletE);
            Box.CloseComplete += new EventHandler(Box_CloseCompletE);
            Box.Show();
        }

        private void Box_CloseComplete(object sender,EventArgs E)
        {
            messageText.Text = "关闭了窗口";
        }

        private void Box_ShowComplete(object sender,EventArgs E)
        {
            messageText.Text = "打开了新窗口";
        }

        private void Box_ButtonClick(object sender,EventArgs E)
        {
            messageText.Text = "你点击了:" + ((messagePagE)sender).Result;
        }

        private void OpenModalBox_Click(object sender,
                title.Text,
                true,
                true
            );
            Box.Effect = GetEffect(Box);
            Box.ShowComplete += new EventHandler(Box_ShowCompletE);
            Box.CloseComplete += new EventHandler(Box_CloseCompletE);
            Box.ShowAsModal();
        }

        private void Openmessage_Click(object sender,RoutedEventArgs E)
        {
            Popupservice service = Popupservice.GetserviceFor(LayoutRoot);
            messagePage Box = service.GetmessagePage(
                message.Text,
                GetButtonType(),
                GetIcon()
            );
            Box.Effect = GetEffect(Box);
            Box.ShowComplete += new EventHandler(Box_ShowCompletE);
            Box.buttonClick += new EventHandler(Box_ButtonClick);
            Box.Show();
        }

        private void OpenModalmessage_Click(object sender,
                GetIcon()
            );
            Box.Effect = GetEffect(Box);
            Box.ShowComplete += new EventHandler(Box_ShowCompletE);
            Box.buttonClick += new EventHandler(Box_ButtonClick);
            Box.ShowAsModal();
        }

        private messageBoxIcon GetIcon()
        {
            switch ((String)((ComboBoxItem)Icon.SELEctedItem).Tag)
            {
                case "No":
                    return null;
                case "Warn":
                    return messageBoxIcon.Warn;
                case "Caution":
                    return messageBoxIcon.Caution;
                case "Error":
                    return messageBoxIcon.Error;
                case "Information":
                    return messageBoxIcon.Information;
                case "Question":
                    return messageBoxIcon.Question;
                default:
                    return null;
            }
        }

        private messageBoxButtonType GetButtonType()         {             String type = (String)((ComboBoxItem)ButtonType.SELEctedItem).Tag;             return (messageBoxButtonTypE)Enum.Parse(                 typeof(messageBoxButtonTypE),                type,                true             );         }     } }

大佬总结

以上是大佬教程为你收集整理的PopUp.xaml_1130全部内容,希望文章能够帮你解决PopUp.xaml_1130所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签:1130popupxaml