/// <summary> /// Add windows icons to the carousel. /// </summary> private void FillCarousel() { ClearCarousel(); foreach (var window in this.FloatingWindowHost.WindowsInIconbar) { WindowIcon icon = new WindowIcon() { Title = window.IconText, Thumbnail = window.WindowThumbnail, #if !SILVERLIGHT Icon = window.Icon as FrameworkElement, #endif FlowDirection = window.FlowDirection, Window = window, IconWidth = this.FloatingWindowHost.IconWidth, IconHeight = this.FloatingWindowHost.IconHeight }; if (WindowIconStyle != null) { icon.Style = WindowIconStyle; //removed access to Application.Current.Resources. Assuming the WindowIcon constructor loads default style using DefaultStyleKey, so overriding that only if WindowIconStyle is not null } icon.Click += new RoutedEventHandler(Icon_Click); carousel.Children.Add(icon); } }
/// <summary> /// IconBorderStyle PropertyChangedCallback call back static function. /// </summary> /// <param name="d">WindowIcon object whose IconBorderStyle property is changed.</param> /// <param name="e">The <see cref="System.Windows.DependencyPropertyChangedEventArgs"/> instance containing the event data.</param> private static void IconBorderStylePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { WindowIcon windowIcon = (WindowIcon)d; if (windowIcon != null && windowIcon.border != null) { windowIcon.border.Style = e.NewValue as Style; } }
/// <summary> /// Handles the Click event of the Icon control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param> private void Icon_Click(object sender, RoutedEventArgs e) { WindowIcon icon = sender as WindowIcon; if (icon != null && icon.Window != null) { this.Hide(); icon.Window.RestoreWindow(); } }
/// <summary> /// Handles the Click event of the Icon control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param> protected virtual void Icon_Click(object sender, RoutedEventArgs e) { WindowIcon icon = sender as WindowIcon; if (icon != null && icon.Window != null) { //if (AutoHide) //TODO: check AutoHide IsOpen = false; //close the Iconbar icon.Window.RestoreWindow(); } }
/// <summary> /// Add windows icons to the carousel. /// </summary> private void FillCarousel() { ClearCarousel(); Style style = this.WindowIconStyle ?? Application.Current.Resources["WindowIconStyle"] as Style; foreach (var window in this.FloatingWindowHost.WindowsInIconBar) { WindowIcon icon = new WindowIcon() { Style = style, Title = window.IconText, Thumbnail = window.WindowThumbnail, FlowDirection = window.FlowDirection, Window = window, IconWidth = this.FloatingWindowHost.IconWidth, IconHeight = this.FloatingWindowHost.IconHeight }; icon.Click += new RoutedEventHandler(Icon_Click); carousel.Children.Add(icon); } }