【问题标题】:Adding MVVM Light to SL5 (via NuGet) project breaks Application.Resources in App.xaml将 MVVM Light 添加到 SL5(通过 NuGet)项目会破坏 App.xaml 中的 Application.Resources
【发布时间】:2012-01-03 16:31:31
【问题描述】:

在我添加 MVVM 灯光后,app.xaml 会让您为默认 ResourceDictionary 提供一个 x:key。即使这样,我似乎也无法让 MainPage.xaml 下的样式解析为我提供的密钥。我试图作弊并使用 Blend,但每次打开修改后的项目时它都会崩溃。

复制步骤:创建新项目(SL5 导航应用程序),然后通过添加库包引用添加 MVVM Light。

【问题讨论】:

    标签: mvvm-light


    【解决方案1】:

    啊。好的...只需在现有节点内移动。错误消息让我觉得我需要命名现有节点并创建第二个节点。

    > <?xml version="1.0" encoding="utf-8"?> <Application 
    >     x:Class="ValidationClient.App" 
    >     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:vm="clr-namespace:ValidationClient.ViewModel" 
    >     mc:Ignorable="d">   <Application.Resources>
    >     <ResourceDictionary>
    >       <ResourceDictionary.MergedDictionaries>
    >         <ResourceDictionary Source="Assets/Styles.xaml" />
    >       </ResourceDictionary.MergedDictionaries>      <vm:ViewModelLocator x:Key="Locator" d:IsDataSource="True" />
    >     </ResourceDictionary>   </Application.Resources> </Application>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-01-03
      • 1970-01-01
      • 1970-01-01
      • 2020-02-06
      • 1970-01-01
      • 1970-01-01
      • 2018-09-27
      相关资源
      最近更新 更多