예제 #1
0
 private void ToggleTileState()
 {
     if (this.CanToggleState())
     {
         if (this.TileState == TileViewItemState.Maximized)
         {
             this.TileState = TileViewItemState.Restored;
             return;
         }
         this.TileState = TileViewItemState.Maximized;
     }
 }
예제 #2
0
        private static void OnTileStatePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            TileViewItem      source   = d as TileViewItem;
            TileViewItemState newValue = (TileViewItemState)e.NewValue;
            TileViewItemState oldValue = (TileViewItemState)e.OldValue;

            if (source != null)
            {
                source.OnTileStateChanged(oldValue, newValue);
            }
            CommandManager.InvalidateRequerySuggested();
        }
예제 #3
0
 private bool CanChangeTileState(TileViewItemState oldValue)
 {
     if (this.ParentTileView.MaximizeMode == TileViewMaximizeMode.Zero && this.TileState != TileViewItemState.Restored || oldValue == TileViewItemState.Restored && this.TileState == TileViewItemState.Minimized && this.ParentTileView.MaximizedItem == null || this.ParentTileView.MaximizeMode == TileViewMaximizeMode.One && this.TileState != TileViewItemState.Maximized && this.ParentTileView.MaximizedContainer == this)
     {
         return(false);
     }
     if (this.ParentTileView.MaximizeMode != TileViewMaximizeMode.One || oldValue != TileViewItemState.Minimized)
     {
         return(true);
     }
     return(this.TileState != TileViewItemState.Restored);
 }
예제 #4
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            TileViewItemState tileState = (TileViewItemState)value;

            switch (tileState)
            {
            case TileViewItemState.Maximized:
                return(FluidContentControlState.Large);

            case TileViewItemState.Minimized:
                return(FluidContentControlState.Small);

            case TileViewItemState.Restored:
                return(FluidContentControlState.Normal);

            default:
                return(FluidContentControlState.Normal);
            }
        }
예제 #5
0
        protected virtual void OnTileStateChanged(TileViewItemState oldValue, TileViewItemState newValue)
        {
            this.UpdateTileStates();
            if (this.headerPart != null)
            {
                this.headerPart.TileState = newValue;
            }
            if (this.cancelTileStateChanged || this.ParentTileView == null)
            {
                if (!this.cancelTileStateChanged)
                {
                    PreviewTileStateChangedEventArgs previewTileStateChangedEventArg = new PreviewTileStateChangedEventArgs()
                    {
                        TileState   = newValue,
                        RoutedEvent = RadTileViewItem.TileStateChangedEvent,
                        Source      = this
                    };
                    this.OnTileStateChanged(previewTileStateChangedEventArg);
                }
                return;
            }
            RadRoutedEventArgs tilesStateChangedArgs = new RadRoutedEventArgs(RadTileView.PreviewTilesStateChangedEvent);

            if (!this.ParentTileView.IsPreviewTilesStateRaised)
            {
                this.ParentTileView.IsPreviewTilesStateRaised = true;
                this.ParentTileView.OnPreviewTilesStateChanged(tilesStateChangedArgs);
            }
            bool rollback = false;

            if (!tilesStateChangedArgs.Handled)
            {
                PreviewTileStateChangedEventArgs previewTileStateChangedEventArg1 = new PreviewTileStateChangedEventArgs()
                {
                    TileState   = oldValue,
                    RoutedEvent = RadTileViewItem.PreviewTileStateChangedEvent,
                    Source      = this
                };
                PreviewTileStateChangedEventArgs args = previewTileStateChangedEventArg1;
                this.OnPreviewTileStateChanged(args);
                if (args.Handled)
                {
                    rollback = true;
                }
                else
                {
                    this.OnTileStateChanged(new TileStateChangedEventArgs(RadTileViewItem.TileStateChangedEvent, this, newValue, oldValue));
                }
            }
            else
            {
                rollback = true;
            }
            if (!this.CanChangeTileState(oldValue))
            {
                rollback = true;
            }
            if (rollback)
            {
                this.ParentTileView.IsPreviewTilesStateRaised = false;
                this.cancelTileStateChanged = true;
                this.TileState = oldValue;
                this.cancelTileStateChanged = false;
                return;
            }
            if (oldValue == TileViewItemState.Maximized && this.TileState == TileViewItemState.Minimized && this.ParentTileView.MaximizedItem == this && this.ParentTileView.MaximizeMode == TileViewMaximizeMode.ZeroOrOne)
            {
                this.ParentTileView.MaximizedItem = null;
                return;
            }
            if (base.Visibility == Visibility.Visible)
            {
                this.ParentTileView.ChangeTileState(this);
            }
        }