public ShadowWindow(PlexWindow window) { InitializeComponent(); Tag = window; Activated += delegate { try { (Tag as PlexWindow).Focus(); } catch (Exception ex) { Debug.WriteLine(ex); } }; //ShadowGrid.Margin = new Thickness(Padding.Left * -1, Padding.Top * -1, Padding.Right * -1, Padding.Bottom * -1); }
public ShadowWindow(PlexWindow window) { InitializeComponent(); /*Tag = window; * Activated += delegate * { * try * { * (Tag as PlexWindow).Focus(); * } * catch (Exception ex) * { * Debug.WriteLine(ex); * } * };*/ //ShadowGrid.Margin = new Thickness(Padding.Left * -1, Padding.Top * -1, Padding.Right * -1, Padding.Bottom * -1); }
public ShadowWindow(PlexWindow window) { Opacity = 0; InitializeComponent(); PlexWindow = window; Binding renderTransformBinding = new Binding() { Source = PlexWindow, Path = new PropertyPath("RenderTransform"), Mode = BindingMode.OneWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; BindingOperations.SetBinding(this, ShadowWindow.RenderTransformProperty, renderTransformBinding); Binding opacityBinding = new Binding() { Source = PlexWindow, Path = new PropertyPath("Opacity"), Mode = BindingMode.OneWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; BindingOperations.SetBinding(ShadowGrid, System.Windows.Controls.Grid.OpacityProperty, opacityBinding); Binding shadowOpacityBinding = new Binding() { Source = PlexWindow, Path = new PropertyPath("ShadowOpacity"), Mode = BindingMode.OneWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; BindingOperations.SetBinding(this, ShadowWindow.OpacityProperty, shadowOpacityBinding); Binding topmostBinding = new Binding() { Source = PlexWindow, Path = new PropertyPath("Topmost"), Mode = BindingMode.OneWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; BindingOperations.SetBinding(this, ShadowWindow.TopmostProperty, topmostBinding); Binding visibilityBinding = new Binding() { Source = PlexWindow, Path = new PropertyPath("Visibility"), Mode = BindingMode.OneWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }; BindingOperations.SetBinding(this, ShadowWindow.VisibilityProperty, visibilityBinding); Loaded += (sender, e) => { PlexWindow.ShiftShadowBehindWindow(); }; IsVisibleChanged += (sender, e) => { PlexWindow.ShiftShadowBehindWindow(); }; }