ismi kapsamına bulunamayan benim Button
Adı 'System.Windows.Controls.Button'
<Window.Resources>
<DataTemplate x:Key="ItemTemplate">
<DockPanel Width="Auto">
<Button DockPanel.Dock="Top">
<Button.Template>
<ControlTemplate >
<Image Source="{Binding image}"/>
</ControlTemplate>
</Button.Template>
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<BeginStoryboard>
<Storyboard>
<local:GridLengthAnimation
Storyboard.TargetName="col1"
Storyboard.TargetProperty="Width"
LeftGridWidth="*" RightGridWidth="1*" Duration="0:0:2"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Button.Triggers>
</Button>
</DockPanel>
</DataTemplate>
</Window.Resources>
<Grid>
...
...
<Grid Grid.Row="2" >
<Grid.ColumnDefinitions>
<ColumnDefinition Name="col1" Width="{Binding ElementName=root, Path=DataContext.gla.LeftGridWidth}" />
<ColumnDefinition Name="col2" Width="{Binding ElementName=root, Path=DataContext.gla.RightGridWidth}" />
</Grid.ColumnDefinitions>
<Grid x:Name="LeftGrid" Grid.Row="2" Grid.Column="0" >
<Border BorderThickness="1" BorderBrush="Red">
<ItemsControl ItemTemplate="{StaticResource ItemTemplate}" ItemsSource="{Binding ElementName=root, Path=DataContext._movies}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="5"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</Border>
</Grid>
</Grid>
</Grid>
sorun için Template
aşağıdakilere sahip col1
Storyboard.TargetName="col1"
tarafından seçilmiş olan olmamasıdır.
An unhandled exception of type 'System.InvalidOperationException' occurred in PresentationFramework.dll
Items Control
kullanıyorum gerçeği ile yapmak zorunda düşünüyorum
Additional information: 'col1' name cannot be found in the name scope of 'System.Windows.Controls.Button'.
... Ben col1
herhangi bulunabilir çalışılacaktır düşündüm: Ben hata alırsınız elemanlar içerir. Bu sorunu nasıl çözeceğimi bilmiyorum.
Herhangi bir yardım çok takdir edilecektir!
Eğer 'GridLengthAnimation' için kod gönderir misiniz -
Basit düzeltme
Storyboard.Target
yerine böyle bir şey bağlayıcı kullanmak yerineStoryboard.TargetName
kullanmak yerine, olurdu? – Abhishek