命令绑定非默认事件

导入NuGet包 必须

Install-Package Microsoft.Xaml.Behaviors.Wpf



        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/xaml/behaviors"

        mc:Ignorable="d"

        Title="WPF EventToCommand Example" Height="300" Width="400">

    

   

       

       

   

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



自己的命名空间一般 clr-namespace:

系统的一般就是类似网址

        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

        xmlns:local="clr-namespace:MyNamespace"

        Title="{x:Static local:MyConstants.AppName}"

        Width="{x:Static local:MyConstants.DefaultWidth}">

   



这里必须用隧道事件preview  用冒泡没反应   就记住mvvm绑定非默认事件只能用隧道

你可能感兴趣的:(c#)