我刚刚将这一行添加到我的XAML文件中:
xmlns:interactivity="clr-namespace:System.Windows.Interactivity"
Run Code Online (Sandbox Code Playgroud)
首先,我得到一个未定义的CLR命名空间错误,但在构建之后它被修复了.现在,当我尝试在mt XAML文件中添加交互标记时,我在此命名空间中收到完整错误.
这是我的代码示例
<Window x:Class="ColorTest.MainWindow"
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:interactivity="clr-namespace:System.Windows.Interactivity"
xmlns:ignore="http://www.ignore.com"
mc:Ignorable="d ignore"
Height="576"
Width="720"
Title="MVVM Light Application"
DataContext="{Binding Main, Source={StaticResource Locator}}">
<Grid x:Name="LayoutRoot" Background="#FF44494D">
<Rectangle x:Name="Color01" Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="100" Margin="10,29,0,0" Stroke="Black" VerticalAlignment="Top" Width="100">
<!--<interactivity:Interaction.Triggers>
<interactivity:EventTrigger EventName="MouseDown">
<interactivity:InvokeCommandAction Command="{Binding MyCommand}"/>
</interactivity:EventTrigger>
</interactivity:Interaction.Triggers>-->
</Rectangle>
</Grid>
Run Code Online (Sandbox Code Playgroud)
在这里提供帮助是我的项目文件的一部分与我的参考
<Reference Include="GalaSoft.MvvmLight.Extras.WPF45">
<HintPath>packages\MvvmLightLibs.4.2.30.0\lib\net45\GalaSoft.MvvmLight.Extras.WPF45.dll</HintPath>
</Reference>
<Reference Include="GalaSoft.MvvmLight.WPF45">
<HintPath>packages\MvvmLightLibs.4.2.30.0\lib\net45\GalaSoft.MvvmLight.WPF45.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Practices.ServiceLocation">
<HintPath>packages\CommonServiceLocator.1.0\lib\NET35\Microsoft.Practices.ServiceLocation.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>packages\MvvmLightLibs.4.2.30.0\lib\net45\System.Windows.Interactivity.dll</HintPath>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
Run Code Online (Sandbox Code Playgroud)
为了完成,我想告诉你我安装了Blend但从未打开或使用它.
这是XAML中交互性的正确名称空间:
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5574 次 |
| 最近记录: |