Exemplo n.º 1
0
 public void UpdateQueue()
 {
     Queue = Player.GetInstance().SongQueue;
     OnPropertyChanged("Queue");
     if (Queue.Count > 6) { IsVerticalRailVisible = ScrollBarVisibility.Visible; }
     else { IsVerticalRailVisible = ScrollBarVisibility.Hidden; }
     OnPropertyChanged("IsVerticalRailVisible");
 }
Exemplo n.º 2
0
 public void DeleteTrack(object parameter)
 {
     Player.GetInstance().RemoveFromQueue((Song) parameter);
     Queue = Player.GetInstance().SongQueue;
     OnPropertyChanged("Queue");
     if (Queue.Count > 6) { IsVerticalRailVisible = ScrollBarVisibility.Visible; }
     else { IsVerticalRailVisible = ScrollBarVisibility.Hidden; }
     OnPropertyChanged("IsVerticalRailVisible");
 }
Exemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ColumnResizeBehavior"/> class.
        /// </summary>
        /// <param name="pListView">The managed list view.</param>
        public ColumnResizeBehavior(ExtendedListView pListView)
        {
            if (pListView == null)
            {
                throw new ArgumentNullException("pListView");
            }

            this.mVerticalScrollBarVisibility = ScrollBarVisibility.Auto;
            this.mListView = pListView;
            this.mListView.Loaded += new RoutedEventHandler(this.OnListViewLoaded);
            this.mListView.Unloaded += new RoutedEventHandler(this.OnListViewUnloaded);
        }
Exemplo n.º 4
0
        protected virtual void UpdateHorizontalScrollBarVisibility()
        {
            if (_defaultHorizontalScrollVisibility == ScrollBarVisibility.Default)
            {
                _defaultHorizontalScrollVisibility =
                    HorizontalScrollBarEnabled ? ScrollBarVisibility.Always : ScrollBarVisibility.Never;
            }

            var newHorizontalScrollVisiblility = ItemsView.HorizontalScrollBarVisibility;

            if (newHorizontalScrollVisiblility == ScrollBarVisibility.Default)
            {
                newHorizontalScrollVisiblility = _defaultHorizontalScrollVisibility;
            }

            HorizontalScrollBarEnabled = newHorizontalScrollVisiblility == ScrollBarVisibility.Always;
        }
Exemplo n.º 5
0
        public static ScrollBarVisiblePolicy ToPlatform(this ScrollBarVisibility visibility)
        {
            switch (visibility)
            {
            case ScrollBarVisibility.Default:
                return(ScrollBarVisiblePolicy.Auto);

            case ScrollBarVisibility.Always:
                return(ScrollBarVisiblePolicy.Visible);

            case ScrollBarVisibility.Never:
                return(ScrollBarVisiblePolicy.Invisible);

            default:
                return(ScrollBarVisiblePolicy.Auto);
            }
        }
Exemplo n.º 6
0
        UwpScrollBarVisibility ScrollBarVisibilityToUwp(ScrollBarVisibility visibility)
        {
            switch (visibility)
            {
            case ScrollBarVisibility.Always:
                return(UwpScrollBarVisibility.Visible);

            case ScrollBarVisibility.Default:
                return(UwpScrollBarVisibility.Auto);

            case ScrollBarVisibility.Never:
                return(UwpScrollBarVisibility.Hidden);

            default:
                return(UwpScrollBarVisibility.Auto);
            }
        }
Exemplo n.º 7
0
        PolicyType ScrollBarVisibilityToGtk(ScrollBarVisibility visibility)
        {
            switch (visibility)
            {
            case ScrollBarVisibility.Default:
                return(PolicyType.Automatic);

            case ScrollBarVisibility.Always:
                return(PolicyType.Always);

            case ScrollBarVisibility.Never:
                return(PolicyType.Never);

            default:
                return(PolicyType.Automatic);
            }
        }
Exemplo n.º 8
0
        internal static UwpScrollBarVisibility ToUwpScrollBarVisibility(this ScrollBarVisibility visibility)
        {
            switch (visibility)
            {
            case ScrollBarVisibility.Always:
                return(UwpScrollBarVisibility.Visible);

            case ScrollBarVisibility.Default:
                return(UwpScrollBarVisibility.Auto);

            case ScrollBarVisibility.Never:
                return(UwpScrollBarVisibility.Hidden);

            default:
                return(UwpScrollBarVisibility.Auto);
            }
        }
Exemplo n.º 9
0
        private ScrollPolicy GetScrollPolicy(ScrollBarVisibility visibility)
        {
            switch (visibility)
            {
            case ScrollBarVisibility.Auto:
                return(ScrollPolicy.Automatic);

            case ScrollBarVisibility.Visible:
                return(ScrollPolicy.Always);

            case ScrollBarVisibility.Disabled:
                return(ScrollPolicy.Never);

            default:
                throw new NotSupportedException();
            }
        }
        ScrollBarVisiblePolicy ScrollBarVisibilityToTizen(ScrollBarVisibility visibility)
        {
            switch (visibility)
            {
            case ScrollBarVisibility.Default:
                return(ScrollBarVisiblePolicy.Auto);

            case ScrollBarVisibility.Always:
                return(ScrollBarVisiblePolicy.Visible);

            case ScrollBarVisibility.Never:
                return(ScrollBarVisiblePolicy.Invisible);

            default:
                return(ScrollBarVisiblePolicy.Auto);
            }
        }
Exemplo n.º 11
0
        void UpdateVerticalScrollBarVisibility()
        {
            if (_defaultVerticalScrollVisibility == 0)
            {
                _defaultVerticalScrollVisibility = VerticalScrollBarEnabled ? ScrollBarVisibility.Always : ScrollBarVisibility.Never;
            }

            var newVerticalScrollVisibility = _view.VerticalScrollBarVisibility;

            if (newVerticalScrollVisibility == ScrollBarVisibility.Default)
            {
                newVerticalScrollVisibility = _defaultVerticalScrollVisibility;
            }

            VerticalScrollBarEnabled = newVerticalScrollVisibility == ScrollBarVisibility.Always;

            this.HandleScrollBarVisibilityChange();
        }
Exemplo n.º 12
0
        void UpdateHorizontalScrollBarVisibility()
        {
            if (_hScrollView != null)
            {
                if (_defaultHorizontalScrollVisibility == 0)
                {
                    _defaultHorizontalScrollVisibility = _hScrollView.HorizontalScrollBarEnabled ? ScrollBarVisibility.Always : ScrollBarVisibility.Never;
                }

                var newHorizontalScrollVisiblility = _view.HorizontalScrollBarVisibility;

                if (newHorizontalScrollVisiblility == ScrollBarVisibility.Default)
                {
                    newHorizontalScrollVisiblility = _defaultHorizontalScrollVisibility;
                }

                _hScrollView.HorizontalScrollBarEnabled = newHorizontalScrollVisiblility == ScrollBarVisibility.Always;
            }
        }
Exemplo n.º 13
0
        public override void OnPropertyChanged(string name)
        {
            base.OnPropertyChanged(name);

            if (string.Equals(name, "CurrentSection"))
            {
                var section = CurrentSection;

                ScrollDirection = string.Equals(section, "songs", StringComparison.OrdinalIgnoreCase) ||
                                  string.Equals(section, "episodes", StringComparison.OrdinalIgnoreCase)
                             ? ScrollDirection.Vertical
                             : ScrollDirection.Horizontal;

                EnableScrolling = !string.Equals(section, "overview", StringComparison.OrdinalIgnoreCase) &&
                                  !string.Equals(section, "seasons", StringComparison.OrdinalIgnoreCase) &&
                                  !string.Equals(section, "itemmovies", StringComparison.OrdinalIgnoreCase) &&
                                  !string.Equals(section, "itemtrailers", StringComparison.OrdinalIgnoreCase) &&
                                  !string.Equals(section, "itemseries", StringComparison.OrdinalIgnoreCase) &&
                                  !string.Equals(section, "itemepisodes", StringComparison.OrdinalIgnoreCase) &&
                                  !string.Equals(section, "itemalbums", StringComparison.OrdinalIgnoreCase) &&
                                  !string.Equals(section, "special features", StringComparison.OrdinalIgnoreCase) &&
                                  !string.Equals(section, "episodes", StringComparison.OrdinalIgnoreCase) &&
                                  !string.Equals(section, "similar", StringComparison.OrdinalIgnoreCase) &&
                                  !string.Equals(section, "soundtrack", StringComparison.OrdinalIgnoreCase) &&
                                  !string.Equals(section, "soundtracks", StringComparison.OrdinalIgnoreCase);

                HorizontalAlignment = string.Equals(section, "songs", StringComparison.OrdinalIgnoreCase)
                             ? HorizontalAlignment.Stretch
                             : HorizontalAlignment.Center;

                EnableHorizontalScrolling = EnableScrolling && ScrollDirection == ScrollDirection.Horizontal;

                EnableVerticalScrolling = EnableScrolling && ScrollDirection == ScrollDirection.Vertical;

                HorizontalScrollBarVisibility = EnableHorizontalScrolling
                    ? ScrollBarVisibility.Hidden
                    : ScrollBarVisibility.Disabled;

                VerticalScrollbarVisibility = EnableVerticalScrolling
                    ? ScrollBarVisibility.Hidden
                    : ScrollBarVisibility.Disabled;
            }
        }
Exemplo n.º 14
0
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            string device = value.ToString();
            ScrollBarVisibility visibility = ScrollBarVisibility.Auto;

            switch (device)
            {
            case "Desktop":
                break;

            case "Mobile":
                visibility = ScrollBarVisibility.Hidden;
                break;

            default:
                break;
            }
            return(visibility);
        }
        private string GetCssOverflow(ScrollBarVisibility scrollBarVisibility)
        {
            switch (scrollBarVisibility)
            {
            case ScrollBarVisibility.Auto:
                return("auto");

            case ScrollBarVisibility.Disabled:
                return("hidden");

            case ScrollBarVisibility.Hidden:
                return("scroll");                        // TODO

            case ScrollBarVisibility.Visible:
                return("scroll");

            default:
                return("hidden");                        // TODO
            }
        }
Exemplo n.º 16
0
        public void SetHorizontalScrollBarVisibility(ScrollBarVisibility scrollBarVisibility)
        {
            _horizontalScrollVisibility = scrollBarVisibility;
            if (_hScrollView == null)
            {
                return;
            }

            if (_defaultHorizontalScrollVisibility == 0)
            {
                _defaultHorizontalScrollVisibility = _hScrollView.HorizontalScrollBarEnabled ? ScrollBarVisibility.Always : ScrollBarVisibility.Never;
            }

            if (scrollBarVisibility == ScrollBarVisibility.Default)
            {
                scrollBarVisibility = _defaultHorizontalScrollVisibility;
            }

            _hScrollView.HorizontalScrollBarEnabled = scrollBarVisibility == ScrollBarVisibility.Always;
        }
Exemplo n.º 17
0
        private static string ScrollBarVisibilityToHtmlString(ScrollBarVisibility scrollVisibility)
        {
            switch (scrollVisibility)
            {
            case ScrollBarVisibility.Disabled:
                return("hidden");

            case ScrollBarVisibility.Auto:
                return("auto");

            case ScrollBarVisibility.Hidden:
                return("hidden");

            case ScrollBarVisibility.Visible:
                return("scroll");

            default:
                return(null);
            }
        }
        private void TryRegisterEvents(ScrollBarVisibility visibility)
        {
            if (
                !_eventsRegistered &&
                (visibility == ScrollBarVisibility.Auto || visibility == ScrollBarVisibility.Visible))
            {
                // Those events are only needed when native scrollbars are used, in order to handle
                // pointer events on the native scrolbars themselves. See HandlePointerEvent for
                // more details.

                _eventsRegistered = true;

                PointerReleased     += ScrollViewer_PointerReleased;
                PointerPressed      += ScrollViewer_PointerPressed;
                PointerCanceled     += ScrollContentPresenter_PointerCanceled;
                PointerMoved        += ScrollContentPresenter_PointerMoved;
                PointerEntered      += ScrollContentPresenter_PointerEntered;
                PointerExited       += ScrollContentPresenter_PointerExited;
                PointerWheelChanged += ScrollContentPresenter_PointerWheelChanged;
            }
        }
Exemplo n.º 19
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            double _result = 0.0;

            if (value != null && parameter != null)
            {
                ScrollBarVisibility _value = (ScrollBarVisibility)value;
                string _param = parameter as String;

                if (_value == ScrollBarVisibility.Auto || _value == ScrollBarVisibility.Visible)
                {
                    if (string.IsNullOrEmpty(_param))
                    {
                        return((double)20.0);
                    }
                    else
                    {
                        _result = System.Convert.ToDouble(_param);
                    }
                }
            }
            return(_result);
        }
Exemplo n.º 20
0
        }         // SetEnabled

        // ----------------------------------------------------------------------
        private void RegisterEvents(DependencyObject start)
        {
            for (int i = 0; i < VisualTreeHelper.GetChildrenCount(start); i++)
            {
                Visual childVisual = VisualTreeHelper.GetChild(start, i) as Visual;
                if (childVisual is Thumb)
                {
                    GridViewColumn gridViewColumn = FindParentColumn(childVisual);
                    if (gridViewColumn == null)
                    {
                        continue;
                    }

                    Thumb thumb = childVisual as Thumb;
                    thumb.PreviewMouseMove           += new MouseEventHandler(ThumbPreviewMouseMove);
                    thumb.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(ThumbPreviewMouseLeftButtonDown);
                    DependencyPropertyDescriptor.FromProperty(
                        GridViewColumn.WidthProperty,
                        typeof(GridViewColumn)).AddValueChanged(gridViewColumn, GridColumnWidthChanged);
                }
                else if (childVisual is GridViewColumnHeader)
                {
                    GridViewColumnHeader columnHeader = childVisual as GridViewColumnHeader;
                    columnHeader.SizeChanged += new SizeChangedEventHandler(GridColumnHeaderSizeChanged);
                }
                else if (this.scrollViewer == null && childVisual is ScrollViewer)
                {
                    this.scrollViewer = childVisual as ScrollViewer;
                    this.scrollViewer.ScrollChanged += new ScrollChangedEventHandler(ScrollViewerScrollChanged);
                    // assume we do the regulation of the horizontal scrollbar
                    this.scrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden;
                    this.scrollViewer.VerticalScrollBarVisibility   = this.verticalScrollBarVisibility;
                }

                RegisterEvents(childVisual); // recursive
            }
        }                                    // RegisterEvents
Exemplo n.º 21
0
 /// <summary>
 /// Gets the value of the VerticalScrollBarVisibility attached property.
 /// </summary>
 /// <param name="control">The control to set the value on.</param>
 /// <param name="value">The value of the property.</param>
 public void SetVerticalScrollBarVisibility(Control control, ScrollBarVisibility value)
 {
     control.SetValue(VerticalScrollBarVisibilityProperty, value);
 }
Exemplo n.º 22
0
 /// <summary>
 /// Gets the value of the VerticalScrollBarVisibility attached property.
 /// </summary>
 /// <param name="control">The control to set the value on.</param>
 /// <param name="value">The value of the property.</param>
 public void SetVerticalScrollBarVisibility(Control control, ScrollBarVisibility value)
 {
     control.SetValue(VerticalScrollBarVisibilityProperty, value);
 }
Exemplo n.º 23
0
        public override void OnPropertyChanged(string name)
        {
            base.OnPropertyChanged(name);

            if (string.Equals(name, "CurrentSection"))
            {
                var section = CurrentSection;

                ScrollDirection = string.Equals(section, "songs", StringComparison.OrdinalIgnoreCase) ||
                    string.Equals(section, "episodes", StringComparison.OrdinalIgnoreCase)
                             ? ScrollDirection.Vertical
                             : ScrollDirection.Horizontal;

                EnableScrolling = !string.Equals(section, "overview", StringComparison.OrdinalIgnoreCase) &&
                    !string.Equals(section, "seasons", StringComparison.OrdinalIgnoreCase) &&
                    !string.Equals(section, "itemmovies", StringComparison.OrdinalIgnoreCase) &&
                    !string.Equals(section, "itemtrailers", StringComparison.OrdinalIgnoreCase) &&
                    !string.Equals(section, "itemseries", StringComparison.OrdinalIgnoreCase) &&
                    !string.Equals(section, "itemepisodes", StringComparison.OrdinalIgnoreCase) &&
                    !string.Equals(section, "itemalbums", StringComparison.OrdinalIgnoreCase) &&
                    !string.Equals(section, "special features", StringComparison.OrdinalIgnoreCase) &&
                    !string.Equals(section, "episodes", StringComparison.OrdinalIgnoreCase) &&
                    !string.Equals(section, "similar", StringComparison.OrdinalIgnoreCase) &&
                    !string.Equals(section, "soundtrack", StringComparison.OrdinalIgnoreCase) &&
                    !string.Equals(section, "soundtracks", StringComparison.OrdinalIgnoreCase);

                HorizontalAlignment = string.Equals(section, "songs", StringComparison.OrdinalIgnoreCase)
                             ? HorizontalAlignment.Stretch
                             : HorizontalAlignment.Center;

                EnableHorizontalScrolling = EnableScrolling && ScrollDirection == ScrollDirection.Horizontal;

                EnableVerticalScrolling = EnableScrolling && ScrollDirection == ScrollDirection.Vertical;

                HorizontalScrollBarVisibility = EnableHorizontalScrolling
                    ? ScrollBarVisibility.Hidden
                    : ScrollBarVisibility.Disabled;

                VerticalScrollbarVisibility = EnableVerticalScrolling
                    ? ScrollBarVisibility.Hidden
                    : ScrollBarVisibility.Disabled;
            }
        }
Exemplo n.º 24
0
 public static void SetVerticalScrollBarVisibility(DependencyObject element, ScrollBarVisibility visibility)
 {
     NoesisGUI_PINVOKE.ScrollViewer_SetVerticalScrollBarVisibility(DependencyObject.getCPtr(element), (int)visibility);
 }
Exemplo n.º 25
0
        public void MainViewModelLineWrapTestMethod()
        {
            MainWindowVM target = new MainWindowVM();
            bool         expectedLineWrapEnabled = false;

            target.LineWrapEnabled = false;
            bool actualLineWrapEnabled = target.LineWrapEnabled;

            Assert.AreEqual(expectedLineWrapEnabled, actualLineWrapEnabled);
            int expectedLineNumber = 1;

            Assert.AreEqual(expectedLineNumber, target.CurrentLineNumber);
            int expectedColNumber = 1;

            Assert.AreEqual(expectedColNumber, target.CurrentColNumber);
            int expectedLineNumberCount = 1;

            Assert.AreEqual(expectedLineNumberCount, target.LineNumbers.Count);
            Assert.IsNotNull(target.LineNumbers[0]);
            double expectedLineNumber0MarginTop = 0.0;

            Assert.AreEqual(expectedLineNumber0MarginTop, target.LineNumbers[0].Margin.Top);
            Assert.AreEqual(0.0, target.LineNumbers[0].Margin.Left);
            Assert.AreEqual(0.0, target.LineNumbers[0].Margin.Right);
            Assert.AreEqual(0.0, target.LineNumbers[0].Margin.Bottom);
            int expectedLineNumber0Number = 1;

            Assert.AreEqual(expectedLineNumber0Number, target.LineNumbers[0].Number);
            ScrollBarVisibility expectedScrollBarVisibility = ScrollBarVisibility.Auto;

            Assert.AreEqual(expectedScrollBarVisibility, target.SsmlTextBox.HorizontalScrollBarVisibility);
            TextWrapping expectedTextWrapping = TextWrapping.NoWrap;

            Assert.AreEqual(expectedTextWrapping, target.SsmlTextBox.TextWrapping);

            expectedLineWrapEnabled = true;
            target.LineWrapEnabled  = true;
            actualLineWrapEnabled   = target.LineWrapEnabled;
            Assert.AreEqual(expectedLineWrapEnabled, actualLineWrapEnabled);
            Assert.AreEqual(expectedLineNumber, target.CurrentLineNumber);
            Assert.AreEqual(expectedColNumber, target.CurrentColNumber);
            Assert.AreEqual(expectedLineNumberCount, target.LineNumbers.Count);
            Assert.IsNotNull(target.LineNumbers[0]);
            Assert.AreEqual(expectedLineNumber0MarginTop, target.LineNumbers[0].Margin.Top);
            Assert.AreEqual(0.0, target.LineNumbers[0].Margin.Left);
            Assert.AreEqual(0.0, target.LineNumbers[0].Margin.Right);
            Assert.AreEqual(0.0, target.LineNumbers[0].Margin.Bottom);
            Assert.AreEqual(expectedLineNumber0Number, target.LineNumbers[0].Number);
            expectedScrollBarVisibility = ScrollBarVisibility.Disabled;
            Assert.AreEqual(expectedScrollBarVisibility, target.SsmlTextBox.HorizontalScrollBarVisibility);
            expectedTextWrapping = TextWrapping.Wrap;
            Assert.AreEqual(expectedTextWrapping, target.SsmlTextBox.TextWrapping);

            expectedLineWrapEnabled = false;
            target.LineWrapEnabled  = false;
            actualLineWrapEnabled   = target.LineWrapEnabled;
            Assert.AreEqual(expectedLineWrapEnabled, actualLineWrapEnabled);
            Assert.AreEqual(expectedLineNumber, target.CurrentLineNumber);
            Assert.AreEqual(expectedColNumber, target.CurrentColNumber);
            Assert.AreEqual(expectedLineNumberCount, target.LineNumbers.Count);
            Assert.IsNotNull(target.LineNumbers[0]);
            Assert.AreEqual(expectedLineNumber0MarginTop, target.LineNumbers[0].Margin.Top);
            Assert.AreEqual(0.0, target.LineNumbers[0].Margin.Left);
            Assert.AreEqual(0.0, target.LineNumbers[0].Margin.Right);
            Assert.AreEqual(0.0, target.LineNumbers[0].Margin.Bottom);
            Assert.AreEqual(expectedLineNumber0Number, target.LineNumbers[0].Number);
            expectedScrollBarVisibility = ScrollBarVisibility.Auto;
            Assert.AreEqual(expectedScrollBarVisibility, target.SsmlTextBox.HorizontalScrollBarVisibility);
            expectedTextWrapping = TextWrapping.NoWrap;
            Assert.AreEqual(expectedTextWrapping, target.SsmlTextBox.TextWrapping);
        }
Exemplo n.º 26
0
 private void SetScrollBarVisibility(ScrollBar sbar, ScrollBarVisibility sbvis)
 {
     if (sbar != null)
     {
         switch (sbvis)
         {
             case ScrollBarVisibility.Disabled:
             {
                 sbar.IsEnabled = false;
                 sbar.Visibility = Visibility.Visible;
                 break;
             }
             case ScrollBarVisibility.Auto:
             {
                 sbar.IsEnabled = true;
                 sbar.Visibility = Visibility.Visible;
                 break;
             }
             case ScrollBarVisibility.Hidden:
             {
                 sbar.IsEnabled = false;
                 sbar.Visibility = Visibility.Collapsed;
                 break;
             }
             case ScrollBarVisibility.Visible:
             {
                 sbar.IsEnabled = true;
                 sbar.Visibility = Visibility.Visible;
                 break;
             }
         }
         InvalidateArrange();
     }
 }
 public static void SetVerticalScrollBarVisibility(System.Windows.DependencyObject element, ScrollBarVisibility verticalScrollBarVisibility)
 {
 }
Exemplo n.º 28
0
        public wpf::System.Windows.Controls.ScrollBarVisibility Convert(ScrollBarVisibility scrollBarVisibility)
        {
            switch (scrollBarVisibility)
            {
                case ScrollBarVisibility.Disabled: return wpf::System.Windows.Controls.ScrollBarVisibility.Disabled;
                case ScrollBarVisibility.Auto: return wpf::System.Windows.Controls.ScrollBarVisibility.Auto;
                case ScrollBarVisibility.Hidden: return wpf::System.Windows.Controls.ScrollBarVisibility.Hidden;
                case ScrollBarVisibility.Visible: return wpf::System.Windows.Controls.ScrollBarVisibility.Visible;
            }

            throw new Granular.Exception("Unexpected ScrollBarVisibility value \"{0}\"", scrollBarVisibility);
        }
Exemplo n.º 29
0
        private void ContentSizeChanged( object sender, SizeChangedEventArgs e )
        {
            lock ( _animationSync )
            {
                var fe = ( Content as FrameworkElement );
                fe.Measure ( new Size ( ActualWidth, double.MaxValue ) );
                if ( ExpandDirection == ExpandDirection.Down || ExpandDirection == ExpandDirection.Up )
                {
                    var height = fe.DesiredSize.Height + fe.Margin.Top + fe.Margin.Bottom + Padding.Top + Padding.Bottom;
                    var oldHeight = _expandHeightValue;
                    if (height <= MaxExpandedHeight)
                    {
                        if (height < ActualHeight && StartExpanded)
                        {
                            height = ActualHeight;
                        }
                        _expandHeightValue = height;
                        VerticalScrollBarVisibility = ScrollBarVisibility.Disabled;
                    }
                    else
                    {
                        _expandHeightValue = MaxExpandedHeight;
                        VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
                    }
                    _host.Height = _expandHeightValue;

                    if (oldHeight != _expandHeightValue)
                    {
                        if ( oldHeight == 0 )
                        {
                            _expander.Height = _expandHeightValue;
                        }
                        else
                        {
                            RunAnimation();
                        }
                    }
                }
                else
                {
                    var width = fe.DesiredSize.Width + fe.Margin.Left + fe.Margin.Right + Padding.Left + Padding.Right;
                    var oldWidth = _expandWidthValue;
                    if ( width <= MaxExpandedWidth )
                    {
                        if ( width < ActualWidth && StartExpanded )
                        {
                            width = ActualWidth;
                        }
                        _expandWidthValue = width;
                    }
                    else
                    {
                        _expandWidthValue = MaxExpandedWidth;
                    }
                    _host.Width = _expandWidthValue;

                    _host.HorizontalAlignment =
                        ExpandDirection == ExpandDirection.Left ? HorizontalAlignment.Right : HorizontalAlignment.Left;

                    if ( oldWidth != _expandWidthValue )
                    {
                        if ( oldWidth == 0 )
                        {
                            _expander.Width = _expandWidthValue;
                        }
                        else
                        {
                            RunAnimation ();
                        }
                    }
                }
            }
        }
Exemplo n.º 30
0
 /// <summary>
 /// Sets the value of the HorizontalScrollBarVisibility dependency property to a given element.
 /// </summary> 
 /// <param name="element">The element on which to set the property value.</param>
 /// <param name="horizontalScrollBarVisibility">The property value to set.</param>
 public static void SetHorizontalScrollBarVisibility(DependencyObject element, ScrollBarVisibility horizontalScrollBarVisibility) 
 { 
     if (null == element)
     { 
         throw new ArgumentNullException("element");
     }
     element.SetValue(HorizontalScrollBarVisibilityProperty, horizontalScrollBarVisibility); 
 }
Exemplo n.º 31
0
        // ----------------------------------------------------------------------
        private void RegisterEvents( DependencyObject start )
        {
            for ( int i = 0; i < VisualTreeHelper.GetChildrenCount( start ); i++ )
            {
                Visual childVisual = VisualTreeHelper.GetChild( start, i ) as Visual;
                if ( childVisual is Thumb )
                {
                    GridViewColumn gridViewColumn = FindParentColumn( childVisual );
                    if ( gridViewColumn == null )
                    {
                        continue;
                    }

                    Thumb thumb = childVisual as Thumb;
                    thumb.PreviewMouseMove += new MouseEventHandler( ThumbPreviewMouseMove );
                    thumb.PreviewMouseLeftButtonDown += new MouseButtonEventHandler( ThumbPreviewMouseLeftButtonDown );
                    DependencyPropertyDescriptor.FromProperty(
                        GridViewColumn.WidthProperty,
                        typeof( GridViewColumn ) ).AddValueChanged( gridViewColumn, GridColumnWidthChanged );
                }
                else if ( childVisual is GridViewColumnHeader )
                {
                    GridViewColumnHeader columnHeader = childVisual as GridViewColumnHeader;
                    columnHeader.SizeChanged += new SizeChangedEventHandler( GridColumnHeaderSizeChanged );
                }
                else if ( this.scrollViewer == null && childVisual is ScrollViewer )
                {
                    this.scrollViewer = childVisual as ScrollViewer;
                    this.scrollViewer.ScrollChanged += new ScrollChangedEventHandler( ScrollViewerScrollChanged );
                    // assume we do the regulation of the horizontal scrollbar
                    this.scrollViewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden;
                    this.scrollViewer.VerticalScrollBarVisibility = this.verticalScrollBarVisibility;
                }

                RegisterEvents( childVisual );  // recursive
            }
        }
Exemplo n.º 32
0
        private static Visibility GetScrollBarVisibility(ScrollBarVisibility scrollBarVisibility, bool isOverflowed)
        {
            switch (scrollBarVisibility)
            {
                case ScrollBarVisibility.Disabled: return Visibility.Collapsed;
                case ScrollBarVisibility.Auto: return isOverflowed ? Visibility.Visible : Visibility.Collapsed;
                case ScrollBarVisibility.Hidden: return Visibility.Collapsed;
                case ScrollBarVisibility.Visible: return Visibility.Visible;
            }

            throw new Granular.Exception("Unexpected ScrollBarVisibility \"{0}\"", scrollBarVisibility);
        }
Exemplo n.º 33
0
 /// <summary>
 /// Coerces the value of the <see cref="Primitives.TextBoxBase.HorizontalScrollBarVisibility"/> property to force the scroll bar
 /// to a disabled state when wrapping is enabled.
 /// </summary>
 private static ScrollBarVisibility CoerceHorizontalScrollBarVisibility(DependencyObject dobj, ScrollBarVisibility value)
 {
     var textBox = (TextBox)dobj;
     if (textBox.TextWrapping == TextWrapping.Wrap)
     {
         return ScrollBarVisibility.Disabled;
     }
     return value;
 }
 public static void SetVerticalScrollBarVisibility(System.Windows.DependencyObject element, ScrollBarVisibility verticalScrollBarVisibility)
 {
 }
Exemplo n.º 35
0
    private void CalculateViewport(Vector2F size, Vector4F padding, ScrollBarVisibility horizontalScrollBarVisibility, ScrollBarVisibility verticalScrollBarVisibility,
                                   out bool horizontalScrollBarVisible, out bool verticalScrollBarVisible, ref Vector2F viewportSize)
    {
      // Determine whether scroll bars are visible.
      horizontalScrollBarVisible = false;
      if (_horizontalScrollBar != null)
      {
        // When the visibility is "Auto", the bar is only visible when content is too large for the viewport.
        if (horizontalScrollBarVisibility == ScrollBarVisibility.Auto)
          horizontalScrollBarVisible = (ExtentWidth > viewportSize.X);
        else if (horizontalScrollBarVisibility == ScrollBarVisibility.Visible)
          horizontalScrollBarVisible = true;

        _horizontalScrollBar.IsVisible = horizontalScrollBarVisible;
        if (horizontalScrollBarVisible)
          _horizontalScrollBar.Measure(size);
      }

      verticalScrollBarVisible = false;
      if (_verticalScrollBar != null)
      {
        // When the visibility is "Auto", the bar is only visible when content is too large for the viewport.
        if (verticalScrollBarVisibility == ScrollBarVisibility.Auto)
          verticalScrollBarVisible = (ExtentHeight > viewportSize.Y);
        else if (verticalScrollBarVisibility == ScrollBarVisibility.Visible)
          verticalScrollBarVisible = true;

        _verticalScrollBar.IsVisible = verticalScrollBarVisible;
        if (verticalScrollBarVisible)
          _verticalScrollBar.Measure(size);
      }

      // Subtract scroll bars from viewport size.
#if !WP7
#if PORTABLE
      if (!_isTouchDevice)
#endif
      {
        // The bar area has to be removed from the content area. (Note: On phone/tablet
        // the bars overlap the content area. They are invisible most of the time.)
        if (horizontalScrollBarVisible)
          viewportSize.Y = size.Y - padding.Y - padding.W - _horizontalScrollBar.DesiredHeight;
        if (verticalScrollBarVisible)
          viewportSize.X = size.X - padding.X - padding.Z - _verticalScrollBar.DesiredWidth;
      }
#endif
    }
Exemplo n.º 36
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (_lightBoxKind == CommonLightBoxKind.SaveCancel)
            {
                Grid.SetRowSpan(this.UpperBorder, 1);
                Grid.SetRow(this.LowerBorder, 1);
                Grid.SetRowSpan(this.LowerBorder, 2);
                this.UpperBorder.Visibility = System.Windows.Visibility.Visible;
            }
            else if (_lightBoxKind == CommonLightBoxKind.SaveOnly)
            {
                Grid.SetRow(this.UpperBorder, 0);
                Grid.SetRowSpan(this.UpperBorder, 3);
                Grid.SetRow(this.LowerBorder, 0);
                Grid.SetRowSpan(this.LowerBorder, 1);
                this.LowerBorder.Visibility = System.Windows.Visibility.Hidden;
                this.UpperBorder.Style = BaseGrid.FindResource("SaveBlackoutBorder") as Style;
                this.UpperBorderTextBlock.Style = BaseGrid.FindResource("SaveTextBlockStyle") as Style;
            }
            else if (_lightBoxKind == CommonLightBoxKind.CancelOnly)
            {
                Grid.SetRow(this.UpperBorder, 0);
                Grid.SetRowSpan(this.UpperBorder, 3);
                Grid.SetRow(this.LowerBorder, 0);
                Grid.SetRowSpan(this.LowerBorder, 1);
                this.LowerBorder.Visibility = System.Windows.Visibility.Hidden;
                this.UpperBorder.Style = BaseGrid.FindResource("CancelBlackoutBorder") as Style;
                this.UpperBorderTextBlock.Style = BaseGrid.FindResource("CancelTextBlockStyle") as Style;
            }

            if (Owner.WindowState == System.Windows.WindowState.Maximized)
            {
                var rect = GetWindowRectangle(Owner);

                this.Left = rect.Left;
                this.Top = rect.Top;
            }
            else
            {
                this.Left = Owner.Left;
                this.Top = Owner.Top;
            }

            if (!_isStretchable)
            {
                BaseGrid.RowDefinitions[0].Height = new GridLength(20);
                BaseGrid.RowDefinitions[1].Height = new GridLength(1.0, GridUnitType.Star);
                BaseGrid.RowDefinitions[2].Height = new GridLength(20);
            }

            this.ScrollViewer.HorizontalScrollBarVisibility = this.HorizontalScrollBarVisibility;
            this.ScrollViewer.VerticalScrollBarVisibility = this.VerticalScrollBarVisibility;

            this.Width = Owner.ActualWidth;
            this.Height = Owner.ActualHeight;

            this.TargetGrid.MaxWidth =
                Math.Max(this.Width -
                (BaseGrid.ColumnDefinitions[0].MinWidth +
                    BaseGrid.ColumnDefinitions[2].MinWidth), 0);
            this.TargetGrid.MaxHeight =
                Math.Max(this.Height -
                (BaseGrid.RowDefinitions[0].MinHeight +
                    BaseGrid.RowDefinitions[2].MinHeight), 0);
        }
Exemplo n.º 37
0
 public static void SetHorizontalScrollBarVisibility(DependencyObject element, ScrollBarVisibility visibility)
 {
     if (element == null)
     {
         throw new ArgumentNullException("element");
     }
     {
         NoesisGUI_PINVOKE.ScrollViewer_SetHorizontalScrollBarVisibility(DependencyObject.getCPtr(element), (int)visibility);
     }
 }
Exemplo n.º 38
0
 public static void SetVerticalScrollBarVisibility(this HtmlStyleDictionary style, ScrollBarVisibility scrollBarVisibility, IHtmlValueConverter converter)
 {
     style.SetValue("overflow-y", converter.ToOverflowString(scrollBarVisibility));
 }
Exemplo n.º 39
0
 private static void UpdateScrollbarVisibility(ScrollBar sbar, ScrollBarVisibility sbv, bool visible)
 {
     if (sbv == ScrollBarVisibility.Auto)
     {
         sbar.Visibility = (visible ? Visibility.Visible : Visibility.Collapsed);
     }
 }
Exemplo n.º 40
0
        /// <summary>
        /// Helper for setting VerticalScrollBarVisibility property.
        /// </summary>
        public static void SetVerticalScrollBarVisibility(DependencyObject element, ScrollBarVisibility verticalScrollBarVisibility)
        {
            if (element == null)
            {
                throw new ArgumentNullException("element");
            }

            element.SetValue(VerticalScrollBarVisibilityProperty, verticalScrollBarVisibility);
        }
Exemplo n.º 41
0
        public static ScrollBarVisibility GetVerticalScrollBarVisibility(DependencyObject element)
        {
            ScrollBarVisibility ret = (ScrollBarVisibility)NoesisGUI_PINVOKE.ScrollViewer_GetVerticalScrollBarVisibility(DependencyObject.getCPtr(element));

            return(ret);
        }
Exemplo n.º 42
0
        private ScrollPolicy GetScrollPolicy(ScrollBarVisibility visibility)
        {
            switch (visibility) {
                case ScrollBarVisibility.Auto:
                    return ScrollPolicy.Automatic;
                case ScrollBarVisibility.Visible:
                    return ScrollPolicy.Always;
                case ScrollBarVisibility.Hidden:
                    return ScrollPolicy.Never;

                default:
                    throw new NotSupportedException();
            }
        }
Exemplo n.º 43
0
 public static void SetVerticalScrollBarVisibility(this HtmlStyleDictionary style, ScrollBarVisibility scrollBarVisibility, IHtmlValueConverter converter)
 {
     style.SetValue("overflow-y", converter.ToOverflowString(scrollBarVisibility));
 }
Exemplo n.º 44
0
        private void ContentSizeChanged(object sender, SizeChangedEventArgs e)
        {
            lock ( _animationSync )
            {
                var fe = (Content as FrameworkElement);
                fe.Measure(new Size(ActualWidth, double.MaxValue));
                if (ExpandDirection == ExpandDirection.Down || ExpandDirection == ExpandDirection.Up)
                {
                    var height    = fe.DesiredSize.Height + fe.Margin.Top + fe.Margin.Bottom + Padding.Top + Padding.Bottom;
                    var oldHeight = _expandHeightValue;
                    if (height <= MaxExpandedHeight)
                    {
                        if (height < ActualHeight && StartExpanded)
                        {
                            height = ActualHeight;
                        }
                        _expandHeightValue          = height;
                        VerticalScrollBarVisibility = ScrollBarVisibility.Disabled;
                    }
                    else
                    {
                        _expandHeightValue          = MaxExpandedHeight;
                        VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
                    }
                    _host.Height = _expandHeightValue;

                    if (oldHeight != _expandHeightValue)
                    {
                        if (oldHeight == 0)
                        {
                            _expander.Height = _expandHeightValue;
                        }
                        else
                        {
                            RunAnimation();
                        }
                    }
                }
                else
                {
                    var width    = fe.DesiredSize.Width + fe.Margin.Left + fe.Margin.Right + Padding.Left + Padding.Right;
                    var oldWidth = _expandWidthValue;
                    if (width <= MaxExpandedWidth)
                    {
                        if (width < ActualWidth && StartExpanded)
                        {
                            width = ActualWidth;
                        }
                        _expandWidthValue = width;
                    }
                    else
                    {
                        _expandWidthValue = MaxExpandedWidth;
                    }
                    _host.Width = _expandWidthValue;

                    _host.HorizontalAlignment =
                        ExpandDirection == ExpandDirection.Left ? HorizontalAlignment.Right : HorizontalAlignment.Left;

                    if (oldWidth != _expandWidthValue)
                    {
                        if (oldWidth == 0)
                        {
                            _expander.Width = _expandWidthValue;
                        }
                        else
                        {
                            RunAnimation();
                        }
                    }
                }
            }
        }
Exemplo n.º 45
0
 /// <summary>
 /// Gets the value of the HorizontalScrollBarVisibility attached property.
 /// </summary>
 /// <param name="control">The control to set the value on.</param>
 /// <param name="value">The value of the property.</param>
 public void SetHorizontalScrollBarVisibility(Control control, ScrollBarVisibility value)
 {
     control.SetValue(HorizontalScrollBarVisibilityProperty, value);
 }
Exemplo n.º 46
0
 public static void SetHorizontalScrollBarVisibility(DependencyObject obj, ScrollBarVisibility value)
 {
     obj.SetValue(HorizontalScrollBarVisibilityProperty, value);
 }
Exemplo n.º 47
0
 /// <summary>
 /// Gets the value of the HorizontalScrollBarVisibility attached property.
 /// </summary>
 /// <param name="control">The control to set the value on.</param>
 /// <param name="value">The value of the property.</param>
 public void SetHorizontalScrollBarVisibility(Control control, ScrollBarVisibility value)
 {
     control.SetValue(HorizontalScrollBarVisibilityProperty, value);
 }
Exemplo n.º 48
0
 public static void UpdateVerticalScrollBarVisibility(this UIScrollView scrollView, ScrollBarVisibility scrollBarVisibility)
 {
     scrollView.ShowsVerticalScrollIndicator = scrollBarVisibility == ScrollBarVisibility.Always || scrollBarVisibility == ScrollBarVisibility.Default;
 }
 public static void SetHorizontalScrollBarVisibility(System.Windows.DependencyObject element, ScrollBarVisibility horizontalScrollBarVisibility)
 {
 }
 private void SetHorizontalScrollBarVisibilityHint( ScrollBarVisibility value )
 {
   this.SetValue( TableViewScrollViewer.HorizontalScrollBarVisibilityHintPropertyKey, value );
 }
Exemplo n.º 51
0
 private QueueControl()
 {
     IsVerticalRailVisible = ScrollBarVisibility.Hidden;
     Queue = Player.GetInstance().SongQueue;
     RemoveTrackCommand = new RelayCommand(DeleteTrack);
 }
 private void SetHorizontalScrollBarVisibilityHint(ScrollBarVisibility value)
 {
     this.SetValue(TableViewScrollViewer.HorizontalScrollBarVisibilityHintPropertyKey, value);
 }
Exemplo n.º 53
0
        public string ToOverflowString(ScrollBarVisibility scrollBarVisibility)
        {
            switch (scrollBarVisibility)
            {
                case ScrollBarVisibility.Disabled: return "hidden";
                case ScrollBarVisibility.Auto: return "auto";
                case ScrollBarVisibility.Hidden: return "hidden";
                case ScrollBarVisibility.Visible: return "scroll";
            }

            throw new Granular.Exception("Unexpected ScrollBarVisibility \"{0}\"", scrollBarVisibility);
        }
 public static void SetHorizontalScrollBarVisibility(System.Windows.DependencyObject element, ScrollBarVisibility horizontalScrollBarVisibility)
 {
 }