Guten Tag,
ich habe folgendes WPF-Problem. Ich folgende DataTemplate für eine ListView definiert und in einem ResourceDictionary (eigenes File) ausgelagert. Wenn ich dieses DataTemplate nun verwenden will bekomme ich einen Fehler im Designer.
Verwende ich das Template direkt (in der ListBox) habe ich kein Problem. Das interessante ist auch, dass es mit Silverlight funktiioniert.
DataTemplate in ResourceDictionary geht nicht :
XML-Code: |
<DataTemplate x:Key="ImageTemplate">
<Intersoft:UXStackPanel Height="Auto" HorizontalAlignment="Stretch" Margin="0" Name="stackPanel1" VerticalAlignment="Stretch" Width="Auto">
<Intersoft:UXHyperlinkButton
Content="{Binding ProjektBzeichnung}"
Command="{Binding Path=LoadProjektCommand}"
Name="btnPrjektName"
Icon="/AppFactory;component/Assets/Images/Application/components_16x16.png"
DisplayMode="ContentAndImage"
Style="{StaticResource SimpleButtonStyle}">
</Intersoft:UXHyperlinkButton>
<TextBlock Text="{Binding ProjektFileName}" Visibility="Collapsed" />
<TextBlock Text="{Binding ProjektVerzeichnis}" Visibility="Collapsed"/>
</Intersoft:UXStackPanel>
</DataTemplate>
<ListBox Name="lbAlleProjekte"
ItemsSource="{Binding Path=ListeAllerProjekte}"
Style="{StaticResource ListBoxStyleProjekte}"
ItemContainerStyle="{StaticResource ListItemStyle}"
ItemTemplate="{StaticResource ImageTemplate}" >
</ListBox>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Assets/Styles/PageStyles.xaml"/>
<ResourceDictionary Source="Assets/Styles/AddressBarStyles.xaml"/>
<ResourceDictionary Source="Assets/Styles/NavigationButtonStyles.xaml"/>
<ResourceDictionary Source="Assets/Styles/BrandingStyles.xaml"/>
<ResourceDictionary Source="Assets/Styles/TextStyles.xaml"/>
<ResourceDictionary Source="Assets/Styles/ListBoxStyles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
|
DataTemplate direkt verwendet geht:
XML-Code: |
<ListBox Name="lbAlleProjekte"
ItemsSource="{Binding Path=ListeAllerProjekte}"
Style="{StaticResource ListBoxStyleProjekte}"
ItemContainerStyle="{StaticResource ListItemStyle}" >
<ListBox.ItemTemplate>
<DataTemplate>
<Intersoft:UXStackPanel Height="Auto" HorizontalAlignment="Stretch" Margin="0" Name="stackPanel1" VerticalAlignment="Stretch" Width="Auto">
<Intersoft:UXHyperlinkButton
Content="{Binding ProjektBzeichnung}"
Command="{Binding Path=LoadProjektCommand}"
Name="btnProjektName"
Icon="/XamlAppFactory;component/Assets/Images/Application/components_16x16.png"
DisplayMode="ContentAndImage"
Style="{StaticResource SimpleButtonStyle}">
</Intersoft:UXHyperlinkButton>
<TextBlock Text="{Binding ProjektFileName}" Visibility="Collapsed" />
<TextBlock Text="{Binding ProjektVerzeichnis}" Visibility="Collapsed"/>
</Intersoft:UXStackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
|
Habe ich etwas grundsätzliches vergessen oder wo ist das Problem?
Danke für Eure Hilfe