Example #1
0
        // Size change to collapse ribbon
        private void OnSizeChanged(object sender, SizeChangedEventArgs e)
        {
            this.MaintainIsCollapsed();

            if (this.iconImage is not null &&
                this.ActualWidth <= 140D + RibbonProperties.GetLastVisibleWidth(this.iconImage).GetZeroIfInfinityOrNaN() + RibbonProperties.GetLastVisibleWidth(this.WindowCommands?.ItemsControl).GetZeroIfInfinityOrNaN())
            {
                this.SetCurrentValue(IsIconVisibleProperty, BooleanBoxes.FalseBox);
                this.TitleBar?.SetCurrentValue(VisibilityProperty, VisibilityBoxes.Collapsed);
                this.WindowCommands?.SetCurrentValue(WindowCommands.ItemsPanelVisibilityProperty, VisibilityBoxes.Collapsed);
            }
Example #2
0
        // Size change to collapse ribbon
        private void OnSizeChanged(object sender, SizeChangedEventArgs e)
        {
            this.MaintainIsCollapsed();

            if (this.iconImage != null &&
                this.ActualWidth <= 140D + RibbonProperties.GetLastVisibleWidth(this.iconImage).GetZeroIfInfinityOrNaN() + RibbonProperties.GetLastVisibleWidth(this.WindowCommands.ItemsControl).GetZeroIfInfinityOrNaN())
            {
                this.SetCurrentValue(IsIconVisibleProperty, false);
                this.TitleBar.SetCurrentValue(VisibilityProperty, Visibility.Collapsed);
                this.WindowCommands.SetCurrentValue(WindowCommands.ItemsPanelVisibilityProperty, Visibility.Collapsed);
            }
            else
            {
                this.InvalidateProperty(IsIconVisibleProperty);
                this.iconImage.SetValue(RibbonProperties.LastVisibleWidthProperty, this.iconImage.ActualWidth);

                this.TitleBar.InvalidateProperty(VisibilityProperty);

                this.WindowCommands.InvalidateProperty(WindowCommands.ItemsPanelVisibilityProperty);
                this.WindowCommands.ItemsControl.SetValue(RibbonProperties.LastVisibleWidthProperty, this.WindowCommands.ItemsControl.ActualWidth);
            }
        }