在爲我的用戶控件添加資源的過程中,我收到了上述錯誤。可能是什麼問題?在UserControl中找不到附加的屬性資源
<UserControl x:Class="PartitionManager.DocStorageView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:WpfToolkit="http://schemas.microsoft.com/wpf/2008/toolkit"
xmlns:System="clr-namespace:System;assembly=mscorlib"
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="800">
<UserControl.Resources></UserControl.Resources>
<WpfToolkit:DataGrid
ItemsSource="{Binding Path=DocStorageInfos}"
HorizontalScrollBarVisibility="Auto" SelectionMode="Extended"
CanUserAddRows="False" CanUserDeleteRows="False"
CanUserResizeRows="False" CanUserSortColumns="False"
AutoGenerateColumns="False" MaxWidth="750">
<WpfToolkit:DataGrid.Columns>
<WpfToolkit:DataGridCheckBoxColumn
Header="Select"
Binding="{Binding Path=IsSelected}"/>
<WpfToolkit:DataGridTextColumn
Header="InterestingName"
Binding="{Binding Path=InterestingName}"/>
</WpfToolkit:DataGrid.Columns>
</WpfToolkit:DataGrid>
</UserControl>
我刪除行 的xmlns:系統=「CLR的命名空間:系統;裝配= mscorlib程序」 ,因爲我似乎並不需要這個命名空間。 (在創建新的用戶控件時,它也不是引用的標準)。 我重建,然後編譯。我進入了命名空間,以確認這是問題所在。 它仍然正確地建立。 因此,我的結論是編譯xaml時可能有問題,儘管代碼 應該已經被編譯了沒有錯誤。 在這種特殊情況下,它已經解決,但如果其他人遇到同樣的問題,解決這個問題可能是有用的。 – HCP 2011-04-28 09:47:48
發佈您的代碼/ XAML將是一個更好的主意,而不是在這裏猜測 – V4Vendetta 2011-04-28 09:52:09
廁所大到立即發佈。
HCP
2011-04-28 09:52:59