반응을 필요로합니다. 에 단추를 누르면 ItemsControl 그 팝업 숨기기. 나는 그 일을해야한다고 가정하고 레이아웃을했지만 작동하지 않습니다. 제발 도와주세요.DataTemplate의 스토리 보드는 extern 컨트롤을 참조합니다.
<Style x:Key="gbListViewItemStyle"
TargetType='{x:Type ListViewItem}' BasedOn='{StaticResource BaseListBoxItemStyle}'>
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<Grid>
<ToggleButton x:Name="pupMenuButton" Command="{Binding Path=ActionCommand}" Style="{DynamicResource FlatToggleButtonStyle}">
<Grid>
<TextBlock>text</TextBlock>
</Grid>
</ToggleButton>
<Popup Placement="Bottom" AllowsTransparency="True" StaysOpen="False"
PopupAnimation="Fade" x:Name="pupMenu"
IsOpen="{Binding ElementName=pupMenuButton, Path=IsChecked}">
<ItemsControl ItemsSource="{Binding Path=ListItems}" >
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Content="{Binding Text1}" Command="{Binding Path=ActionCommand}" CommandParameter="{Binding}" Style="{DynamicResource ButtonStyleFlatBorder}">
<Button.Triggers>
<EventTrigger RoutedEvent="ButtonBase.Click">
<BeginStoryboard>
<Storyboard>
<BooleanAnimationUsingKeyFrames Storyboard.TargetProperty="(ToggleButton.IsChecked)" Storyboard.TargetName="pupMenuButton">
<DiscreteBooleanKeyFrame KeyTime="0" Value="False"/>
</BooleanAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Button.Triggers>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Popup>
</Grid>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
반환 된 오류 : "."System.Windows.Controls.Button "네임 스페이스에"pupMenuButton "이름을 찾을 수 없습니다" 스토리 보드가 작동하지 않습니다. 이유가 무엇입니까? 일하는 방법?
"Restyled MenuItem"- 이것은 내가 필요한 것입니다. 고맙습니다. – Ivan