Quantcast
Viewing all articles
Browse latest Browse all 2

Frame popup - opening and closing?

Hi Tim,

I suggest using Popup control to get such kinds of effects. You can place a Popup on the page and click a button to show it and disable all the other controls. After you click a OK button on the Popup, it will be closed and all other controls are enabled again:
Xaml:

<Page x:Class="WpfBrowserApplication3.Page1"
   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
   xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
   xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
   mc:Ignorable="d" 
   d:DesignHeight="500" d:DesignWidth="763"
   Title="Page1"><Grid><Popup Name="popupDialog" PlacementTarget="{Binding ElementName=richTextBox1}" Placement="Center"><StackPanel><Frame Source="Page2.xaml"/><Button Click="Button_Click">Ok</Button></StackPanel></Popup><StackPanel Name="mainPanel" Orientation="Vertical"><RichTextBox Height="450" HorizontalAlignment="Center" Name="richTextBox1" VerticalAlignment="Top" Width="733"/><Button Margin="10" Content="Button" HorizontalAlignment="Center" Height="23" Name="button1" Width="75" Click="button1_Click" VerticalAlignment="Bottom"/></StackPanel></Grid></Page>

Code:

  public partial class Page1 : Page
  {
    public Page1()
    {
      InitializeComponent();
    }

    private void button1_Click(object sender, RoutedEventArgs e)
    {
      popupDialog.IsOpen = true;

      mainPanel.IsEnabled = false;
    }

    private void Button_Click(object sender, RoutedEventArgs e)
    {
      popupDialog.IsOpen = false;

      mainPanel.IsEnabled = true;
    }
  }

Let me know if this does not help.
Aland Li


Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.

Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>