当前位置:网站首页 / WPF / 正文

Ay写给2022的纯xaml [wpf4net5] - Caliburn Micro-调用vm的方法[3/16]

时间:2021年09月17日 | 作者 : aaronyang | 分类 : WPF | 浏览: 656次 | 评论 0

相关文章

Ay写给2022的纯xaml [wpf4net5] - Caliburn-Micro[1/16],MyGet-WPF-aaronyang技术分享 (ayjs.net) Download

Ay写给2022的纯xaml [wpf4net5] - Caliburn-Micro-绑定[2/16]-WPF-aaronyang技术分享 (ayjs.net) Download

Ay写给2022的纯xaml [wpf4net5] - Caliburn-Micro-调用vm的方法[3/16]-WPF-aaronyang技术分享 (ayjs.net)  Download

Ay写给2022的纯xaml [wpf4net5] - Caliburn-Micro-Coroutine协程[4/16]-WPF-aaronyang技术分享 (ayjs.net) Download

Ay写给2022的纯xaml [wpf4net5] - Caliburn-Micro-Execute 异步里面更新界面UI[5/16]-WPF-aaronyang技术分享 (ayjs.net) 第5天CM.zip

Ay写给2022的纯xaml [wpf4net5] - Caliburn-Micro-EventAggregation[6/16]-WPF-aaronyang技术分享 (ayjs.net) 第6天CM.zip

Ay写给2022的纯xaml [wpf4net5] - Caliburn Micro-Conductor[7/16]-WPF-aaronyang技术分享 (ayjs.net) 第7天CM.zip

Ay写给2022的纯xaml [wpf4net5] - Caliburn Micro-Bubbling[8/16]-WPF-aaronyang技术分享 (ayjs.net)  第8天CM.zip



增加个TaskHelper,后面用的到

using System.Threading.Tasks;

namespace cm1
{
    public static class TaskHelper
    {
#if SILVERLIGHT
        public static Task<T> FromResult<T>(T result)
        {
            var tcs = new TaskCompletionSource<T>();

            tcs.SetResult(result);

            return tcs.Task;
        }

        public static Task Delay(int milliseconds)
        {
            return Task.Factory.StartNew(() => Thread.Sleep(milliseconds));
        }
#else
        public static Task<T> FromResult<T>(T result) => Task.FromResult(result);
        public static Task Delay(int milliseconds) => Task.Delay(milliseconds);
#endif
    }
}


新建 ActionsViewModel.cs

using System;
using System.Threading.Tasks;
using Caliburn.Micro;

namespace cm1.ViewModels
{
    public class ActionsViewModel : Screen
        {

            private string output="输出";
            public string Output
            {
                get { return output; }
                set { Set(ref output, value); }
            }

        }
}

新建ActionsView.xaml

      非常重要的2个引入

      xmlns:cm="http://caliburnmicro.com"

      xmlns:i="http://schemas.microsoft.com/xaml/behaviors"

      非常重要的待通知的属性写法,继承了Screen类后

            private string output="";

            public string Output

            {

                get { return output; }

                set { Set(ref output, value); }

            }


<Page x:Class="cm1.Views.ActionsView"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:cm="http://caliburnmicro.com"
      xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
      mc:Ignorable="d" 
      d:DesignHeight="300" d:DesignWidth="300"
      Title="ActionsView">

    <Page.Resources>
        <Style x:Key="ActionButtonStyle" TargetType="Button">
            <Setter Property="Margin" Value="0,10,0,0"/>
            <Setter Property="HorizontalAlignment" Value="Stretch"/>
        </Style>
    </Page.Resources>

    <Grid>
        <ScrollViewer>
            <StackPanel Margin="24,12">
                <TextBlock>
                        <Run Text="Output:" FontWeight="Bold"/>
                        <Run Text="{Binding Output}"/>
                </TextBlock>

              
            </StackPanel>
        </ScrollViewer>
    </Grid>
</Page>

在Bootstrapper.cs修改Configure()

  protected override void Configure()
        {
            container = new SimpleContainer();

            container.Instance(container);

            container
                .Singleton<IWindowManager, WindowManager>()
                .Singleton<IEventAggregator, EventAggregator>();

            container
               .PerRequest<ShellViewModel>()
               .PerRequest<MenuViewModel>()
               .PerRequest<BindingsViewModel>()
               .PerRequest<ActionsViewModel>();
        }

打开MenuViewModel.cs 添加个新的菜单

        public MenuViewModel(INavigationService navigationService)
        {
            this.navigationService = navigationService;

            Features = new BindableCollection<FeatureViewModel>
            {
                new FeatureViewModel("Binding Conventions", "Binding view model properties to your view.", typeof(BindingsViewModel)),
                new FeatureViewModel("Action Conventions", "Wiring view events to view model methods.", typeof(ActionsViewModel)),
            };
        }

准备工作完成后,运行

image.png

image.png

新增个文本框和按钮

                <TextBlock Text="Name"/>
                <TextBox x:Name="Name" Margin="0,10,0,0" HorizontalAlignment="Stretch"/>

                <Button x:Name="Clear" Content="Clear" Style="{StaticResource ActionButtonStyle}"/>

按照约定: 这个 Name属性,这个当作参数,有个Clear的方法

using System;
using System.Threading.Tasks;
using Caliburn.Micro;

namespace cm1.ViewModels
{
    public class ActionsViewModel : Screen
    {
        public void Clear() => Output = String.Empty;





        private string output = "输出";
        public string Output
        {
            get { return output; }
            set { Set(ref output, value); }
        }

    }
}

单击Clear

image.png

同理继续调用个无参的方法

<Button x:Name="SimpleSayHello" Content="Simple Say Hello" Style="{StaticResource ActionButtonStyle}"/>

和vm的

using System;
using System.Threading.Tasks;
using Caliburn.Micro;

namespace cm1.ViewModels
{
    public class ActionsViewModel : Screen
    {
        public void Clear() => Output = String.Empty;
        public void SimpleSayHello() => Output = "3Q AY,Hello from Caliburn.Micro";




        private string output = "输出";
        public string Output
        {
            get { return output; }
            set { Set(ref output, value); }
        }

    }
}

单击以后

image.png


使用通用的方式 

cm:Message.Attach="方法名"

using System;
using System.Threading.Tasks;
using Caliburn.Micro;

namespace cm1.ViewModels
{
    public class ActionsViewModel : Screen
    {
        public void Clear() => Output = String.Empty;
        public void SimpleSayHello() => Output = "3Q AY,Hello from Caliburn.Micro";

        private string output = "输出";
        public string Output
        {
            get { return output; }
            set { Set(ref output, value); }
        }

    }
}

xaml

  <Button cm:Message.Attach="SimpleSayHello" Content="Simple Say Hello (using Message.Attach)" Style="{StaticResource ActionButtonStyle}"/>

使用cm:Message.Attach="SimpleSayHello"


按钮默认attach事件是click,如何指定事件调用呢?方法如下,增加个鼠标双击

m:Message.Attach="[Event MouseDoubleClick] = [SimpleSayHello]" 

                <Button cm:Message.Attach="[Event MouseDoubleClick] = [SimpleSayHello]" Content="Simple Say Hello (Custom Event - Double Tapped)" Style="{StaticResource ActionButtonStyle}"/>

image.png

使用行为的方式调用方法

                <Button x:Name="FullSyntax" Content="Simple Say Hello (Full Behaviour Syntax)" Style="{StaticResource ActionButtonStyle}">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="Click">
                            <cm:ActionMessage MethodName="SimpleSayHello" />
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </Button>

image.png




调用有参数的方法

默认方式

<Button x:Name="SayHello" Content="Say Hello (with parameter)" Style="{StaticResource ActionButtonStyle}"/>

VM

using System;
using System.Threading.Tasks;
using Caliburn.Micro;

namespace cm1.ViewModels
{
    public class ActionsViewModel : Screen
    {
        public void Clear() => Output = String.Empty;
        public void SimpleSayHello() => Output = "3Q AY,Hello from Caliburn.Micro";

        public void SayHello(string name) => Output = $"Hello {name}";




        private string output = "输出";
        public string Output
        {
            get { return output; }
            set { Set(ref output, value); }
        }

    }
}

运行,在文本框输入 AY2022xaml,单击Say Hello (with parameter) 按钮

image.png


测试1:

修改 TextBox的名字 从Name -> Name123

 <TextBox x:Name="Name123" Margin="0,10,0,0" HorizontalAlignment="Stretch"/>

结论: 参数获取不到


测试2:

修改VM的sayhello的参数名字

public void SayHello(string name123) => Output = $"Hello {name123}";

结论:运行正确


测试3:大小写是否有影响

结论:无影响


测试4:名称增加下划线 是否有影响

结论:无影响


测试5: 增加复选框,2个类型参数

vm

using System;
using System.Threading.Tasks;
using Caliburn.Micro;

namespace cm1.ViewModels
{
    public class ActionsViewModel : Screen
    {
        public void Clear() => Output = String.Empty;
        public void SimpleSayHello() => Output = "3Q AY,Hello from Caliburn.Micro";

        public void SayHello(string Name123_12) => Output = $"Hello {Name123_12}";
        public void SayHelloBool(string Name123_12,bool is1) => Output = $"Hello {Name123_12} {is1}";



        private string output = "输出";
        public string Output
        {
            get { return output; }
            set { Set(ref output, value); }
        }

    }
}

xaml

<Page x:Class="cm1.Views.ActionsView"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:cm="http://caliburnmicro.com"
      xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
      mc:Ignorable="d" 
      d:DesignHeight="300" d:DesignWidth="300"
      Title="ActionsView">

    <Page.Resources>
        <Style x:Key="ActionButtonStyle" TargetType="Button">
            <Setter Property="Margin" Value="0,10,0,0"/>
            <Setter Property="HorizontalAlignment" Value="Stretch"/>
        </Style>
    </Page.Resources>

    <Grid>
        <ScrollViewer>
            <StackPanel Margin="24,12">
                <TextBlock>
                        <Run Text="Output:" FontWeight="Bold"/>
                        <Run Text="{Binding Output}"/>
                </TextBlock>
                <TextBlock Text="Name"/>
                <TextBox x:Name="Name123_12" Margin="0,10,0,0" HorizontalAlignment="Stretch"/>

                <CheckBox x:Name="is1" Margin="0,10,0,0" HorizontalAlignment="Stretch"/>
                
                <Button x:Name="Clear" Content="Clear" Style="{StaticResource ActionButtonStyle}"/>
                <Button x:Name="SimpleSayHello" Content="Simple Say Hello" Style="{StaticResource ActionButtonStyle}"/>
                <Button cm:Message.Attach="SimpleSayHello" Content="Simple Say Hello (using Message.Attach)" Style="{StaticResource ActionButtonStyle}"/>

                <Button cm:Message.Attach="[Event MouseDoubleClick] = [SimpleSayHello]" Content="Simple Say Hello (Custom Event - Double Tapped)" Style="{StaticResource ActionButtonStyle}"/>
                
                <Button x:Name="FullSyntax" Content="Simple Say Hello (Full Behaviour Syntax)" Style="{StaticResource ActionButtonStyle}">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="Click">
                            <cm:ActionMessage MethodName="SimpleSayHello" />
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </Button>

                <Button x:Name="SayHello" Content="Say Hello (with parameter)" Style="{StaticResource ActionButtonStyle}"/>
                <Button x:Name="SayHelloBool" Content="Say Hello (with parameter)" Style="{StaticResource ActionButtonStyle}"/>
                
            </StackPanel>
        </ScrollViewer>
    </Grid>
</Page>

结论:运行正确

image.png





测试6:增加列表类型

xaml

<Page x:Class="cm1.Views.ActionsView"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:cm="http://caliburnmicro.com"
      xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
      mc:Ignorable="d" 
      d:DesignHeight="300" d:DesignWidth="300"
      Title="ActionsView">

    <Page.Resources>
        <Style x:Key="ActionButtonStyle" TargetType="Button">
            <Setter Property="Margin" Value="0,10,0,0"/>
            <Setter Property="HorizontalAlignment" Value="Stretch"/>
        </Style>
    </Page.Resources>

    <Grid>
        <ScrollViewer>
            <StackPanel Margin="24,12">
                <TextBlock>
                        <Run Text="Output:" FontWeight="Bold"/>
                        <Run Text="{Binding Output}"/>
                </TextBlock>
                <TextBlock Text="Name"/>
                <TextBox x:Name="Name123_12" Margin="0,10,0,0" HorizontalAlignment="Stretch"/>

                <CheckBox x:Name="is1" Margin="0,10,0,0" HorizontalAlignment="Stretch"/>

                <ComboBox x:Name="cbo1" Margin="0,10,0,0" HorizontalAlignment="Stretch">
                    <ComboBoxItem Content="第1个item"></ComboBoxItem>
                    <ComboBoxItem Content="第2个item"></ComboBoxItem>
                </ComboBox>
                
                <Button x:Name="Clear" Content="Clear" Style="{StaticResource ActionButtonStyle}"/>
                <Button x:Name="SimpleSayHello" Content="Simple Say Hello" Style="{StaticResource ActionButtonStyle}"/>
                <Button cm:Message.Attach="SimpleSayHello" Content="Simple Say Hello (using Message.Attach)" Style="{StaticResource ActionButtonStyle}"/>

                <Button cm:Message.Attach="[Event MouseDoubleClick] = [SimpleSayHello]" Content="Simple Say Hello (Custom Event - Double Tapped)" Style="{StaticResource ActionButtonStyle}"/>
                
                <Button x:Name="FullSyntax" Content="Simple Say Hello (Full Behaviour Syntax)" Style="{StaticResource ActionButtonStyle}">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="Click">
                            <cm:ActionMessage MethodName="SimpleSayHello" />
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </Button>

                <Button x:Name="SayHello" Content="Say Hello (with parameter)" Style="{StaticResource ActionButtonStyle}"/>
                <Button x:Name="SayHelloBool" Content="SayHelloBool (with parameter)" Style="{StaticResource ActionButtonStyle}"/>

                <Button x:Name="SayHelloCbo" Content="SayHelloCbo (with parameter)" Style="{StaticResource ActionButtonStyle}"/>
                
            </StackPanel>
        </ScrollViewer>
    </Grid>
</Page>

vm

using System;
using System.Threading.Tasks;
using Caliburn.Micro;

namespace cm1.ViewModels
{
    public class ActionsViewModel : Screen
    {
        public void Clear() => Output = String.Empty;
        public void SimpleSayHello() => Output = "3Q AY,Hello from Caliburn.Micro";

        public void SayHello(string Name123_12) => Output = $"Hello {Name123_12}";
        public void SayHelloBool(string Name123_12,bool is1) => Output = $"Hello {Name123_12} {is1}";

        public void SayHelloCbo(string cbo1) => Output = $"Hello {cbo1} ";

        private string output = "输出";
        public string Output
        {
            get { return output; }
            set { Set(ref output, value); }
        }

    }
}

image.png

结论:运行正确,cbo的绑定方式写法就不测了


这里只是测试,CM中约定由于对我来说像个盲盒,所以表单这块,如果我CM约定搞不定,我会考虑wpf通用binding写法


测试7:指定控件名字,不让cm帮我们根据属性名匹配的方式传参

                <Button cm:Message.Attach="SayHello(Name12312)" Content="Say Hello (with parameter and Message.Attach)" Style="{StaticResource ActionButtonStyle}"/>

image.png




异步调用个方法

xaml

 <Button x:Name="SayGoodbye" Content="Say Goodbye (异步调用)" Style="{StaticResource ActionButtonStyle}"/>

vm新增

        public Task SayGoodbyeAsync(string Name123_12)
        {
            Output = $"AY 杨洋 Goodbye {Name123_12}";

            return TaskHelper.FromResult(true);
        }

为了CM约定,我们x:Name里面我们把下划线去掉,因为_是cm中表示 对象的 点号,是二级属性的

image.png

在CM中调用方法之前,增加一个Can,是否能调用方法,异步的约定 是 方法名 后面加个 Async

那些需要textBox输入值后 才能单击的按钮会生效

CM的约定:void 方法名(参数列表)      和      bool Can方法名(参数列表)   

image.png

修改VM的方法

using System;
using System.Threading.Tasks;
using Caliburn.Micro;

namespace cm1.ViewModels
{
    public class ActionsViewModel : Screen
    {
        public void Clear() => Output = String.Empty;
        public void SimpleSayHello() => Output = "3Q AY,Hello from Caliburn.Micro";




        public bool CanSayHello(string Name12312) => !String.IsNullOrEmpty(Name12312);

        public void SayHello(string Name12312) => Output = $"Hello {Name12312}";

        public bool CanSayGoodbye(string Name12312) => !String.IsNullOrEmpty(Name12312);
        public Task SayGoodbyeAsync(string Name12312)
        {
            Output = $"AY 杨洋 Goodbye {Name12312}";

            return TaskHelper.FromResult(true);
        }

        public void SayHelloBool(string Name12312, bool is1) => Output = $"Hello {Name12312} {is1}";

        public void SayHelloCbo(string cbo1) => Output = $"Hello {cbo1} ";

        private string output = "输出";
        public string Output
        {
            get { return output; }
            set { Set(ref output, value); }
        }

    


    }
}

xaml

<Page x:Class="cm1.Views.ActionsView"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:cm="http://caliburnmicro.com"
      xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
      mc:Ignorable="d" 
      d:DesignHeight="300" d:DesignWidth="300"
      Title="ActionsView">

    <Page.Resources>
        <Style x:Key="ActionButtonStyle" TargetType="Button">
            <Setter Property="Margin" Value="0,10,0,0"/>
            <Setter Property="HorizontalAlignment" Value="Stretch"/>
        </Style>
    </Page.Resources>

    <Grid>
        <ScrollViewer>
            <StackPanel Margin="24,12">
                <TextBlock>
                        <Run Text="Output:" FontWeight="Bold"/>
                        <Run Text="{Binding Output}"/>
                </TextBlock>
                <TextBlock Text="Name"/>
                <TextBox x:Name="Name12312" Margin="0,10,0,0" HorizontalAlignment="Stretch"/>
                <CheckBox x:Name="is1" Margin="0,10,0,0" HorizontalAlignment="Stretch"/>
                <ComboBox x:Name="cbo1" Margin="0,10,0,0" HorizontalAlignment="Stretch">
                    <ComboBoxItem Content="第1个item"></ComboBoxItem>
                    <ComboBoxItem Content="第2个item"></ComboBoxItem>
                </ComboBox>
                <Button x:Name="Clear" Content="Clear" Style="{StaticResource ActionButtonStyle}"/>
                <Button x:Name="SimpleSayHello" Content="Simple Say Hello" Style="{StaticResource ActionButtonStyle}"/>
                <Button cm:Message.Attach="SimpleSayHello" Content="Simple Say Hello (using Message.Attach)" Style="{StaticResource ActionButtonStyle}"/>
                <Button cm:Message.Attach="[Event MouseDoubleClick] = [SimpleSayHello]" Content="Simple Say Hello (Custom Event - Double Tapped)" Style="{StaticResource ActionButtonStyle}"/>
                <Button x:Name="FullSyntax" Content="Simple Say Hello (Full Behaviour Syntax)" Style="{StaticResource ActionButtonStyle}">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="Click">
                            <cm:ActionMessage MethodName="SimpleSayHello" />
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </Button>
                <Button x:Name="SayHello" Content="Say Hello (with parameter)" Style="{StaticResource ActionButtonStyle}"/>
                <Button x:Name="SayHelloBool" Content="SayHelloBool (with parameter)" Style="{StaticResource ActionButtonStyle}"/>
                <Button x:Name="SayHelloCbo" Content="SayHelloCbo (with parameter)" Style="{StaticResource ActionButtonStyle}"/>
                <Button cm:Message.Attach="SayHello(Name12312)" Content="Say Hello (with parameter and Message.Attach)" Style="{StaticResource ActionButtonStyle}"/>
                
                
                <Button x:Name="SayGoodbye" Content="Say Goodbye (异步调用)" Style="{StaticResource ActionButtonStyle}"/>
            </StackPanel>
        </ScrollViewer>
    </Grid>
</Page>

运行后

image.png

效果类似,cm帮我们 写了Command 和 CanExecuteCommand的效果



行为方式 传参

vm

 public void SimpleSayHelloParameter(string a, double b,int c)
        {
            Output = $"参数a={a}, 参数b={b}, 参数c={c}, 参数bc的积={b*c}";
        }

xaml

   <Button x:Name="FullSyntax2" Content="行为方式传参" Style="{StaticResource ActionButtonStyle}">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="Click">
                            <cm:ActionMessage MethodName="SimpleSayHelloParameter" >
                                <cm:Parameter Value="ay" />
                                <cm:Parameter Value="1991.9" />
                                <cm:Parameter Value="10" />
                            </cm:ActionMessage>
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </Button>


image.png






修改文件编码

image.png

有时候,明明写法正确,但是运行报错,可能是文件编码问题,我遇到了,修改了编码就好了。

image.png





本文由 安徽 合肥 杨洋 1991年的 英文名AY   ===来自网站 www.ayjs.net 编写

本文由 安徽 合肥 杨洋 1991年的 英文名AY   ===来自网站 www.ayjs.net 编写


这个示例的意思,在一个列表中有多种ViewModel,希望不同的vm按照对应的view显示

这个内容下篇再总结了

本文代码下载:Download


net framework 类库net5 中的替代类库

Microsoft.Expression.Interactions

System.Windows.Interactivity

Microsoft.Xaml.Behaviors.Wpf



其他Ay准备升级到net5的纯xaml库

【ay wpf markup】AY XAML应该这样玩【1/18】-WPF-aaronyang技术分享 (ayjs.net)

【ay wpf markup】AY XAML应该这样玩【2/18】-WPF-aaronyang技术分享 (ayjs.net)

【ay wpf markup】AY XAML应该这样玩-写个计算器【3/18】-WPF-aaronyang技术分享 (ayjs.net)

【ay wpf markup】AY XAML应该这样玩-for循环【4/18】-WPF-aaronyang技术分享 (ayjs.net)

【ay wpf markup】AY XAML应该这样玩-ChangedHandler【5/18】-WPF-aaronyang技术分享 (ayjs.net)

【ay wpf markup】AY XAML应该这样玩-ResourceCollection和ScriptHandler【6/18】-WPF-aaronyang技术分享 (ayjs.net)

【ay wpf markup】AY XAML应该这样玩-ResourceObject【7/18】-WPF-aaronyang技术分享 (ayjs.net)

【ay wpf markup】AY XAML应该这样玩-ScriptHandler组合,也是最常用的【8/18】-WPF-aaronyang技术分享 (ayjs.net)

【ay wpf markup】AY XAML应该这样玩-语法集合【9/18】-WPF-aaronyang技术分享 (ayjs.net)

【ay wpf markup】AY XAML应该这样玩-Tower of Hanoi【10/18】-WPF-aaronyang技术分享 (ayjs.net)

【ay wpf markup】AY XAML应该这样玩-写个简单的移动【11/18】-WPF-aaronyang技术分享 (ayjs.net)

【ay wpf markup】AY XAML应该这样玩-写个复杂的绘图【12/18】-WPF-aaronyang技术分享 (ayjs.net)

【ay wpf markup】AY XAML应该这样玩-写个复杂的颜色环【13/18】-WPF-aaronyang技术分享 (ayjs.net)

【ay wpf markup】AY XAML应该这样玩-获得焦点全选【14/18】-WPF-aaronyang技术分享 (ayjs.net)

【ay wpf markup】AY XAML应该这样玩-把Additional.Operations当资源【15/18】-WPF-aaronyang技术分享 (ayjs.net)

【ay wpf markup】AY XAML应该这样玩-给ListView创建数据【16/18】-WPF-aaronyang技术分享 (ayjs.net)

【ay wpf markup】AY XAML应该这样玩-和后台ViewModel交互,操作方法【17/18】-WPF-aaronyang技术分享 (ayjs.net)



默认代码模板

Window

<Window x:Class="Features.CrossPlatform.Views.ShellView"
        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:cal="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro.Platform"
        mc:Ignorable="d"
        Title="ShellView" Height="450" Width="800">
    <Grid>
     
    </Grid>
</Window>

Page

<Page x:Class="Features.CrossPlatform.Views.MenuView"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      mc:Ignorable="d" 
      d:DesignHeight="300" d:DesignWidth="300"
      Title="">

    <Grid>

    </Grid>
</Page>

UserControl

<UserControl  x:Class="cm1.Views.FeatureView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:cal="clr-namespace:Caliburn.Micro;assembly=Caliburn.Micro.Platform"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid>

    </Grid>
</UserControl>



推荐您阅读更多有关于“wpfcm,”的文章

猜你喜欢

额 本文暂时没人评论 来添加一个吧

发表评论

必填

选填

选填

必填

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

  查看权限

合肥科大智能常年招聘C# .NET CORE,vue前端,JAVA开发,有想换工作的私聊我AY唯一QQ:875556003和AY交流

抖音号:wpfui 工作是wpf,不接活,目前主要折腾maui

AYUI8社区版Github地址:前往获取

杨洋(AaronYang简称AY,安徽六安人)目前是个人,还没公司AY唯一QQ:875556003和AY交流

高中学历,2010年开始web开发,2015年1月17日开始,兴趣学习研究WPF

声明:AYUI7个人与商用免费,源码可购买。部分DEMO不免费.AY主要靠卖技术服务挣钱

不是从我处购买的ayui7源码,我不提供任何技术服务,如果你举报从哪里买的,我可以帮你转正为我的客户,并送demo

查看捐赠

AYUI7.X MVC教程 更新如下:

第一课 第二课 程序加密教程

vs2015 企业版密钥HM6NR-QXX7C-DFW2Y-8B82K-WTYJV

vs2017 企业版密钥NJVYC-BMHX2-G77MM-4XJMR-6Q8QF

标签列表