设为首页 加入收藏

TOP

WPF PrismDialog PopupWindowAction使用MetroWindow(一)
2019-09-17 18:58:22 】 浏览:54
Tags:WPF PrismDialog PopupWindowAction 使用 MetroWindow

本示例必须在prism5.0版本以上

PopupWindowAction如何使用MetroWindow?

 

public class Window1ViewModel:BindableBase,IInteractionRequestAware
    {
        #region Properties
        private string str;

        public string Str
        {
            get { return str; }
            set { SetProperty(ref str, value); }
        }

        #endregion

        /// <summary>
        /// Cancel
        /// </summary>
        private DelegateCommand<Window> clickCommand;

        public DelegateCommand<Window> ClickCommand
        {
            get
            {
                if (clickCommand == null)
                    clickCommand = new DelegateCommand<Window>(Click);
                return clickCommand;
            }
        }

        private INotification  notification;

        public INotification Notification
        {
            get { return notification; }
            set { SetProperty(ref notification,value); }
        }

        public Action FinishInteraction { get; set; }

        private void Click(Window window)
        {
            var _notification = (Window1DialogModel)Notification;
            _notification.Str = this.str;
            _notification.Confirmed = true;
            FinishInteraction?.Invoke();
        }
    }
Window1ViewModel

 

  public class Window1DialogModel : IConfirmation
    {
        public string Str { get; set; }

        //Interface Content
        public bool Confirmed { get ; set ; }
        public string Title { get ; set ; }
        public object Content { get; set; }
    }
Window1DialogModel

 

<UserControl x:Class="Pfu.ScanSnap.Home.UI.SshUIUserData.Views.Window1"
                           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"
                           xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
                           xmlns:MetroControls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
                           xmlns:prism="http://www.codeplex.com/prism"
                           xmlns:prop="clr-namespace:Pfu.ScanSnap.Home.UI.SshUIUserData.Properties"
                           xmlns:util ="clr-namespace:Pfu.ScanSnap.Home.UI.SshUIUserData.Util"
                           prism:ViewModelLocator.AutoWireViewModel="True"
                           mc:Ignorable="d"
                           BorderBrush="#FF666666"
                           BorderThickness="1"
                           Width="500" Height="300">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary  Source="/SshUIUserData;component/Styles/ResourceDictionary.xaml"/>
                <ResourceDictionary  Source="/SshUIUserData;component/Styles/BaseStyles.xaml" />

                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.Buttons.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>

    <Grid>
        <StackPanel Orientation="Vertical" VerticalAlignment="Center">
            <TextBox Text="{Binding Str}"/>
            <Button Content="Click" Command="{Binding ClickCo
首页 上一页 1 2 下一页 尾页 1/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇visual studio 2019安装秘钥 下一篇.netcore-FreeSql的使用-搭建cont..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目