/// <summary>
 /// Initializes a new instance of the
 /// <see cref="T:System.Windows.Automation.Peers.FloatableWindowAutomationPeer" />
 /// class.
 /// </summary>
 /// <param name="owner">
 /// The <see cref="T:System.Windows.Controls.FloatableWindow" /> to
 /// associate with this
 /// <see cref="T:System.Windows.Automation.Peers.FloatableWindowAutomationPeer" />.
 /// </param>
 public FloatableWindowAutomationPeer(FloatableWindow owner)
     : base(owner)
 {
     if (owner == null)
     {
         throw new ArgumentNullException("owner");
     }
     this.RefreshIsTopMostProperty();
 }
Exemple #2
0
        /// <summary>
        /// Executed when the a key is presses when the window is open.
        /// </summary>
        /// <param name="sender">Sender object.</param>
        /// <param name="e">Key event args.</param>
        private void ChildWindow_KeyDown(object sender, KeyEventArgs e)
        {
            FloatableWindow ew = sender as FloatableWindow;

            Debug.Assert(ew != null, "FloatableWindow instance is null.");

            // Ctrl+Shift+F4 closes the FloatableWindow
            if (e != null && !e.Handled && e.Key == Key.F4 &&
                ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control) &&
                ((Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift))
            {
                ew.Close();
                e.Handled = true;
            }
        }
Exemple #3
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            //DiagramChildWindows diagramchildwindows = new DiagramChildWindows(3);

            //diagramchildwindows.Show();

            FloatableWindow tempFW = new FloatableWindow();//TheTemplatedOne
            //f1.ShowDialog();
            tempFW.DialogResult = true;
            tempFW.Width = this.LayoutRoot.ActualWidth * 0.9;
            tempFW.Height = this.LayoutRoot.ActualHeight * 0.9;
            tempFW.Title = "";                           //窗口标题
            tempFW.HasCloseButton = true;                            //是否显示X按钮
            tempFW.ParentLayoutRoot = this.LayoutRoot;                   //父容器可以是Gird、Canvas等
            tempFW.Content = new DiagramChatControl(3) ;  //窗口内容,可以是文字,也可以是UserControl等
            tempFW.ResizeMode = ResizeMode.CanResize;
            tempFW.ShowDialog();
            //f.Height = 100;
            //f.Width = 100;
            //f.Background = new SolidColorBrush(Colors.Yellow);
            //f.ShowDialog();
        }