WPF 自定义MessageBox 弹窗提示 弹窗加载

1. 下载Dll

       https://pan.baidu.com/s/1sKGQ0uHXHkkhXtMvUYPQHA

2.在项目中添加引用

        略

3.在Xaml中引入名称空间

     xmlns:myControl ="clr-namespace:MyCustomControlLibrary;assembly=MyCustomControlLibrary"

 

4.先看效果

5.使用代码

      Xaml

      
               
               
                   
                   
                   
               


               
               
                   
                   
                   
               

               
                   
                   
                   
               

               
                   
                   
                   
               

               
                   
               


               
               
                   
                   
                   
               

               
           
      

 

     Cs代码中

 

             private void AlertOne_Click(object sender, RoutedEventArgs e)
        {
            MyCustomControlLibrary.MMessageBox.ShowAlert(
               "Success!",
                Orientation.Horizontal,
                null,
                "#3ca9fe",
                false);

            //  MyCustomControlLibrary.MMessageBox.ShowSuccessAlert();
            // MyCustomControlLibrary.MMessageBox.ShowSuccessAlert("Success!");

        }

        private void AlertTwo_Click(object sender, RoutedEventArgs e)
        {
            var point = this.Mborder.PointToScreen(new Point());
            //Mborder 窗口内容区域的边框
            var size = new Size(this.Mborder.ActualWidth, this.Mborder.ActualHeight);

            MyCustomControlLibrary.MMessageBox.ShowModalAlert(
                "Success!",
                point,
                size,
                Orientation.Vertical,
               String.Empty,
                "#3ca9fe");
            //MyCustomControlLibrary.MMessageBox.ShowSuccessModelAlert(size,point);
            //MyCustomControlLibrary.MMessageBox.ShowSuccessModelAlert(size, point, "Success!");
        }

        private void AlertThree_Click(object sender, RoutedEventArgs e)
        {
            var point = this.Mborder.PointToScreen(new Point());
            //Mborder 窗口内容区域的边框
            var size = new Size(this.Mborder.ActualWidth, this.Mborder.ActualHeight);

            MyCustomControlLibrary.MMessageBox.ShowModalAlert(
                "Success!",
                point,
                size,
                Orientation.Vertical,
                 null,
                "#ffffffff");
        }

        private void loadOne_Click(object sender, RoutedEventArgs e)
        {
            MyCustomControlLibrary.MMessageBox.ShowLoading(
                MyCustomControlLibrary.MMessageBox.LoadType.Circle,
                "加载中。。。",
                new Point(0, 0),
                new Size(0, 0),
                "",
                Orientation.Horizontal,
                "#ffffff",
                3);

        }

        private void loadTwo_Click(object sender, RoutedEventArgs e)
        {
            var point = this.Mborder.PointToScreen(new Point());
            //Mborder 窗口内容区域的边框
            var size = new Size(this.Mborder.ActualWidth, this.Mborder.ActualHeight);
            MyCustomControlLibrary.MMessageBox.ShowLoading(
                MyCustomControlLibrary.MMessageBox.LoadType.Circle,
                String.Empty,
                 point,
                 size,
                "",
                Orientation.Horizontal,
                "#ffffff",
                3);
        }

        private void loadThree_Click(object sender, RoutedEventArgs e)
        {
            var point = this.Mborder.PointToScreen(new Point());
            //Mborder 窗口内容区域的边框
            var size = new Size(this.Mborder.ActualWidth, this.Mborder.ActualHeight);
            MyCustomControlLibrary.MMessageBox.ShowLoading(
            MyCustomControlLibrary.MMessageBox.LoadType.Three,
            "Loading...",
             new Point(0, 0),
            new Size(0, 0),
            null,
            Orientation.Vertical,
            "#ffffff",
            3);
        }

        private void loadFour_Click(object sender, RoutedEventArgs e)
        {

            var point = this.Mborder.PointToScreen(new Point());
            //Mborder 窗口内容区域的边框
            var size = new Size(this.Mborder.ActualWidth, this.Mborder.ActualHeight);
            MyCustomControlLibrary.MMessageBox.ShowLoading(
                MyCustomControlLibrary.MMessageBox.LoadType.Foure,
                "Loading...",
                point,
                size,
                "",
                Orientation.Vertical,
                "#ffffff",
                5);
        }

        private void loadfive_Click(object sender, RoutedEventArgs e)
        {
            var point = this.Mborder.PointToScreen(new Point());
            //Mborder 窗口内容区域的边框
            var size = new Size(this.Mborder.ActualWidth, this.Mborder.ActualHeight);
            MyCustomControlLibrary.MMessageBox.ShowLoading(
                MyCustomControlLibrary.MMessageBox.LoadType.Two,
                "Loading...",
                point,
                size,
                "",
                Orientation.Vertical,
                "#ffffff",
                3);
        }

        private void loadSix_Click(object sender, RoutedEventArgs e)
        {
            var point = this.Mborder.PointToScreen(new Point());
            //Mborder 窗口内容区域的边框
            var size = new Size(this.Mborder.ActualWidth, this.Mborder.ActualHeight);
            MyCustomControlLibrary.MMessageBox.ShowLoading(
                MyCustomControlLibrary.MMessageBox.LoadType.Firve,
                "Loading...",
                point,
                size,
                "",
                Orientation.Vertical,
                "#ffffff",
                3);
        }

        private void loadSever_Click(object sender, RoutedEventArgs e)
        {
            MyCustomControlLibrary.MMessageBox.ShowLoading(
              MyCustomControlLibrary.MMessageBox.LoadType.One,
              "Loading...",
           new Point(0, 0),
            new Size(0, 0),
             null,
              Orientation.Vertical,
              "#ffffff",
              3);
        }

        private void loadeight_Click(object sender, RoutedEventArgs e)
        {
            var point = this.Mborder.PointToScreen(new Point());
            //Mborder 窗口内容区域的边框
            var size = new Size(this.Mborder.ActualWidth, this.Mborder.ActualHeight);
            MyCustomControlLibrary.MMessageBox.ShowLoading(
                MyCustomControlLibrary.MMessageBox.LoadType.Grid,
                "Loading...",
                point,
                size,
                "",
                Orientation.Vertical,
                "#ffffff",
                3);
        }

        private void loadnine_Click(object sender, RoutedEventArgs e)
        {
            var point = this.Mborder.PointToScreen(new Point());
            //Mborder 窗口内容区域的边框
            var size = new Size(this.Mborder.ActualWidth, this.Mborder.ActualHeight);
            MyCustomControlLibrary.MMessageBox.ShowLoading(
                MyCustomControlLibrary.MMessageBox.LoadType.One,
                "Loading...",
                point,
                size,
                "",
                Orientation.Vertical,
                "#ffffff",
                3);
        }

        private void MessageboxOne_Click(object sender, RoutedEventArgs e)
        {
            MyCustomControlLibrary.MMessageBox.Reault reault = MyCustomControlLibrary.MMessageBox.ShouBox(
                "操作成功!",
                "信息",
                MyCustomControlLibrary.MMessageBox.ButtonType.No,
                MyCustomControlLibrary.MMessageBox.IconType.success
                );

            if (reault == MyCustomControlLibrary.MMessageBox.Reault.No)
            {
                MyCustomControlLibrary.MMessageBox.ShowSuccessAlert("你点了 取消");
            }
        }

        private void MessageboxTwo_Click(object sender, RoutedEventArgs e)
        {
            MyCustomControlLibrary.MMessageBox.Reault reault = MyCustomControlLibrary.MMessageBox.ShouBox(
             "操作成功!",
             "信息",
             MyCustomControlLibrary.MMessageBox.ButtonType.Yes,
             MyCustomControlLibrary.MMessageBox.IconType.success
             );
            var point = this.Mborder.PointToScreen(new Point());
            //Mborder 窗口内容区域的边框
            var size = new Size(this.Mborder.ActualWidth, this.Mborder.ActualHeight);
            if (reault == MyCustomControlLibrary.MMessageBox.Reault.Yes)
            {
                MyCustomControlLibrary.MMessageBox.ShowSuccessModelAlert(size, point, "你点了 确定");
            }
        }

        private void MessageboxThree_Click(object sender, RoutedEventArgs e)
        {
            MyCustomControlLibrary.MMessageBox.Reault reault = MyCustomControlLibrary.MMessageBox.ShouBox(
           "是否要删除!",
           "警 告",
           MyCustomControlLibrary.MMessageBox.ButtonType.YesNo,
           MyCustomControlLibrary.MMessageBox.IconType.warring,
           Orientation.Horizontal,
           "是",
           "否"
           );

            if (reault == MyCustomControlLibrary.MMessageBox.Reault.Yes)
            {
                MyCustomControlLibrary.MMessageBox.ShowSuccessAlert("你点了 是");
            }
            else
            {
                MyCustomControlLibrary.MMessageBox.ShowSuccessAlert("你点了 否");
            }
        }

 

你可能感兴趣的:(WPF,加载动画,WPF自定义UI)