Zdravím,
mám problém s editovaním šablóny komponenty ListView vo WPF. Akonáhle dám vytvoriť kópiu originálnej šablóny ListView-u, tak mi Blend hlási chyby typu: "Komponenta ScrollViewer nemôže byť potomkom komponenty ClassicBorderDecorator" kvôli nastaveniu vlastnosti "Style" ScrollViewver-u na hodnotu "{Dynamic Resource}". Po nastavení vlastnosti na defaultnú hodnotu sa program síce spustí, avšak v tabuľke sú vidno iba Itemy a nie ColumnHeader. Môžete mi poradiť čo s tým?
Tu je XAML kód okna:
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="WpfApplication3.Window1"
x:Name="Window"
Title="Window1"
Width="640" Height="480" xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Classic">
<Window.Resources>
<ControlTemplate x:Key="ListViewControlTemplate1" TargetType="{x:Type ListView}">
<Microsoft_Windows_Themes:ClassicBorderDecorator x:Name="Bd" SnapsToDevicePixels="True" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderStyle="Sunken" BorderThickness="{TemplateBinding BorderThickness}">
<ScrollViewer Padding="{TemplateBinding Padding}">
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</ScrollViewer>
</Microsoft_Windows_Themes:ClassicBorderDecorator>
<ControlTemplate.Triggers>
<Trigger Property="IsGrouping" Value="True">
<Setter Property="ScrollViewer.CanContentScroll" Value="False"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Window.Resources>
<Grid x:Name="LayoutRoot">
<ListView Template="{DynamicResource ListViewControlTemplate1}">
<ListView.View>
<GridView>
<GridViewColumn Header="Column1" Width="150"/>
<GridViewColumn Header="Column2" Width="150"/>
</GridView>
</ListView.View>
</ListView>
</Grid>
</Window>