Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Wpf Close popup when ListboxItem is selected

$
0
0

Hi,

I have listbox inside popup. How would I close popup right after I select item from list box; here is code:

<Popupx:Name="ColorPopup"AllowsTransparency="True"IsOpen="{Binding ElementName=ColorToggle, Path=IsChecked}"Placement="Bottom"StaysOpen="False"PlacementTarget="{Binding ElementName=ColorToggle}"><Borderx:Name="DropDownBorder1"BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}"Margin="0, 0,5,5"BorderThickness="1"Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"Effect="{DynamicResource WindowShadowEffect}"><ListBoxName="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>

Viewing all articles
Browse latest Browse all 18858

Trending Articles