/// <summary> /// Windows the state changed. If state is Hidden then remove window from visual tree. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="WindowStateChangedEventArgs"/> instance containing the event data.</param> private void WindowStateChanged(object sender, WindowStateChangedEventArgs e) { if (e.NewWindowState == Infragistics.Controls.Interactions.WindowState.Hidden) { LayoutRoot.Children.Remove(_videoVindow); _videoVindow.MainWindow.WindowStateChanged -= WindowStateChanged; _videoVindow = null; } }
/// <summary> /// Handles the MouseLeftButtonDown event of the DateTimeSeries control (Title Click). /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.Input.MouseButtonEventArgs"/> instance containing the event data.</param> private void DateTimeSeries_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { var vm = (VideoClipViewModel)((TitleView)sender).DataContext; // Create new window var videoVindow = new VideoWindowView(); videoVindow.DataContext = vm; videoVindow.Show(); }
/// <summary> /// Handles the MouseLeftButtonDown event of the DateTimeSeries control (Title Click). /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.Input.MouseButtonEventArgs"/> instance containing the event data.</param> private void DateTimeSeries_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { var vm = (VideoClipViewModel)((TitleView)sender).DataContext; // Create new window if (_videoVindow == null) { _videoVindow = new VideoWindowView(); _videoVindow.MainWindow.WindowStateChanged += WindowStateChanged; LayoutRoot.Children.Add(_videoVindow); } //Set the data context for the video window asynchronously. this.Dispatcher.BeginInvoke( () => { _videoVindow.SetDataContext(vm); }); }