<Popup x:Name="AddItemPopup" IsLightDismissEnabled="True" Width="435" Height="265" > <StackPanel Background="Black"> <Border Background="#85C54C" BorderThickness="4"> <Grid Margin="10"> <Grid.RowDefinitions> <RowDefinition/> <RowDefinition/> <RowDefinition/> <RowDefinition/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="300"/> </Grid.ColumnDefinitions> <TextBlock Text="Name:" Style="{StaticResource AddItemText}" /> <TextBlock Text="Quantity:" Grid.Row="1" Style="{StaticResource AddItemText}" /> <TextBlock Text="Store:" Grid.Row="2" Style="{StaticResource AddItemText}" /> <TextBox x:Name="ItemName" Grid.Column="1" Style="{StaticResource AddItemTextBox}" /> <TextBox x:Name="ItemQuantity" Grid.Row="1" Grid.Column="1" Style="{StaticResource AddItemTextBox}" /> <ComboBox x:Name="ItemStore" Grid.Column="1" Grid.Row="2" Style="{StaticResource AddItemStore}" ItemsSource="{Binding StoreList}" DisplayMemberPath="" /> <StackPanel Orientation="Horizontal" Grid.Row="3" HorizontalAlignment="Center" Grid.ColumnSpan="2"> <Button Click="AddButtonClick">Add Item</Button> </StackPanel> </Grid> </Border> </StackPanel> </Popup>
控制弹窗的可见性 :IsOpen属性 为true 是可见 ,false 不可见
弹出的位置为右下角