2012-03-03 85 views
1

我得到了以下來源廣東話解決嵌套的資源

<UserControl.Resources> 
    <DataTemplate x:Key="ItemTemplate"> 
     <ListBox ItemsSource="{Binding Inventory}" 
          ScrollViewer.HorizontalScrollBarVisibility="Disabled" 
          ScrollViewer.VerticalScrollBarVisibility="Disabled" 
          ItemTemplate="{StaticResource ItemChildTemplate}" 
          ItemContainerStyle="{StaticResource ListBoxChildItemStyle}" 
          BorderThickness="0"> 
     </ListBox> 
    </DataTemplate> 
    <DataTemplate x:Key="ItemChildTemplate"> ... </DataTemplate> 
    <Style x:Key="ListBoxChildItemStyle" TargetType="{x:Type ListBoxItem}">...</Style> 
</UserControl.Resources> 

我得到:

資源ListBoxChildItemStyle無法解析。

資源ItemChildTemplate無法解析。

我根本沒有看到問題。 Expression Blend也沒有任何建議。

回答

2

在靜態引用之前需要聲明資源。交換資源的順序,以便永遠不會引用稍後出現在文件中的資源。

+0

作品 - 非常感謝! – damike 2012-03-03 11:42:47