Dobrý den. Poradíte mi prosím? Snažím se použít UserControl kterou jsem vytvořil.
User Control
<UserControl x:Class="ContentViewLib.userContentView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:l="clr-namespace:ContentViewLib.Graphic"
mc:Ignorable="d"
d:DesignHeight="300" Width="445">
<UserControl.Resources>
<l:RowsConvertor x:Key="myConverter"/>
<Style x:Key="myItemStyle" TargetType="{x:Type ListViewItem}">
<Setter Property="BorderBrush" Value="Black"/>
<Setter Property="Margin" Value="1,1,1,0"/>
<Setter Property="Padding" Value="2,2"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
<Setter Property="VerticalContentAlignment" Value="Stretch"></Setter>
<Setter Property="BorderThickness" Value="0.1,0.0,0.5,0.5"/>
<Setter Property="Background">
<Setter.Value>
<Binding RelativeSource="{RelativeSource Self}" Converter="{StaticResource myConverter}"/>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid>
<ListView ItemContainerStyle="{StaticResource myItemStyle}" VerticalAlignment="Stretch" HorizontalContentAlignment="Stretch" AlternationCount="2" Name="listView" ItemsSource="{Binding}" SelectionMode="Single" BorderThickness="1" ClipToBounds="False" Margin="0,12,0,0"/>
</Grid>
</UserControl>
Window ve kterém ji zobrazuji
<Window x:Class="Pujcovna.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ContentViewLib;assembly=ContentViewLib"
Title="Půjčovna" Height="363" Width="786" WindowState="Maximized" Topmost="False" WindowStartupLocation="CenterScreen">
<Grid>
<local:userContentView></local:userContentView> // Zde se hlásí chyba
</Grid>
</Window>
Hlásí mi to chybu: Error 1 Cannot find resource named 'myItemStyle'. Resource names are case sensitive.
Zvláštní je že když pustím program tak funguje správně.
V design editoru mi to hlásí Cannon create instance of "userContentView".
Mám VS 2012 RC takže doufam že je chyba v mém kódu.