簡體   English   中英

WPF UserControl直接內容

[英]WPF UserControl Direct Content

遇到了似乎很受歡迎的問題,但不確定這里發生了什么。 我在Visual Studio 2015社區中有一個解決方案,其中有一個asp.net webapi項目,一個WPF項目,其中使用nuget添加了棱鏡庫。 我正在使用Prism 6,並希望使用模塊創建解決方案。 一切正常,直到我向模塊添加用戶控件,然后出現錯誤“類型'UserControl'不支持直接內容”,並且在grid標記下以及在其下放置的所有內容均看到錯誤。 我添加到xaml文件中的只是新的棱鏡命名空間和viewmodellocator代碼行。 有人可以指出我正確的方向。

以下是我創建的Usercontrol,錯誤位於帶有網格標簽的行

<UserControl x:Class="LoginModule.Views.LoginForm"
         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:local="clr-namespace:LoginModule.Views"
         xmlns:prism="http://prismlibrary.com/"
         prism:ViewModelLocator.AutoWireViewModel="True"
         mc:Ignorable="d" 
         d:DesignHeight="300" d:DesignWidth="300">
<Grid>

</Grid>

感謝你的幫助。 我終於想通了。 我添加了參考System.Xaml,它消失了。 顯然,IComponentConnector已從System.Windows.Markup移至System.Xaml。 添加參考可以解決該問題,並且所有內容至少都不會出錯。 考慮到我正在開發的模塊都是從類庫開始的,這並不奇怪,因此創建項目時不像創建wpf項目時那樣添加System.Xaml。 希望這可以省去我前一天左右的困惑。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM