我在xaml中收到類似「類型引用無法找到名爲'Sign'的公共類型」的錯誤。我該如何解決它。 Sign類在同一個程序集中。類型引用無法找到名爲
<DataTemplate DataType="{x:Type local:Sign}">
<Expander Padding="4"
IsExpanded="{Binding RelativeSource={
RelativeSource Mode=FindAncestor, AncestorType={
x:Type ListBoxItem}}, Path=IsSelected}">
<Expander.Header>
<TextBlock Text="{Binding Name}" ... />
</Expander.Header>
<DockPanel LastChildFill="True">
<Border DockPanel.Dock="Left" CornerRadius="16" BorderBrush="WhiteSmoke" Background="AliceBlue" BorderThickness="5" HorizontalAlignment="Center" VerticalAlignment="Center">
<Image Source="{Binding Icon}" Width="90" Height="90" Stretch="Fill" />
</Border>
...
</DockPanel>
</Expander>
你記得在這樣的頂部添加本地命名空間? 'xmlns:local =「clr-namespace:MyNamespace」' –