1
我在列表框內部彈出。我從列表框中選擇項目後,如何關閉彈出窗口; 這裏是代碼:Wpf當選擇ListboxItem時關閉彈出框
<Popup x:Name="ColorPopup" AllowsTransparency="True"
IsOpen="{Binding ElementName=ColorToggle, Path=IsChecked}" Placement="Bottom" StaysOpen="False" PlacementTarget="{Binding ElementName=ColorToggle}">
<Border x:Name="DropDownBorder1" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" Margin="0, 0,5,5" BorderThickness="1" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" Effect="{DynamicResource WindowShadowEffect}">
<ListBox Name="ColorList" VerticalContentAlignment="Stretch" Margin="1, 3, 1, 3" IsEnabled="True" Grid.Column="0" Background="Transparent" HorizontalContentAlignment="Center" SelectedItem="{Binding fColor}" SelectionMode="Single" Style="{StaticResource HorizontalListBoxStyle2}" ItemsSource="{Binding FillColors}">
</ListBox>
</Border>
</Popup>