private int GetScrollStep(SizeF available, StripViewButtons scrollButtons) { if (this.layoutInfo == null) { return(0); } RectangleF clientRectangle = this.GetClientRectangle(available); float num = 0.0f; float val1 = 0.0f; float layoutLength = this.layoutInfo.layoutLength; switch (this.layoutInfo.align) { case StripViewAlignment.Top: case StripViewAlignment.Bottom: if ((double)layoutLength > (double)clientRectangle.Width) { num = layoutLength - clientRectangle.Width; } val1 = clientRectangle.Width; break; case StripViewAlignment.Right: case StripViewAlignment.Left: if ((double)layoutLength > (double)clientRectangle.Height) { num = layoutLength - clientRectangle.Height; } val1 = clientRectangle.Height; break; } float val2 = scrollButtons != StripViewButtons.LeftScroll ? num - (float)this.ScrollOffset : (float)this.ScrollOffset; return((int)Math.Min(val1, val2)); }
internal bool CanScroll(StripViewButtons button) { if (this.layoutInfo == null || this.layoutInfo.itemCount <= 1) { return(false); } if (this.layoutInfo.itemAlign == StripViewItemAlignment.Far ^ this.ShouldUseRightToLeft()) { button = this.FlipScrollButtons(button); } return(this.GetScrollStep(this.PreviousConstraint, button) > 0); }
private StripViewButtons FlipScrollButtons(StripViewButtons buttons) { if (buttons == StripViewButtons.LeftScroll) { buttons = StripViewButtons.RightScroll; } else { buttons = StripViewButtons.LeftScroll; } return(buttons); }
private int GetScrollStep(SizeF available, StripViewButtons scrollButtons) { if (this.layoutInfo == null) { return(0); } //apply border and padding RectangleF client = this.GetClientRectangle(available); float hiddenLength = 0; float maxLength = 0; float itemLength = this.layoutInfo.layoutLength; switch (this.layoutInfo.align) { case StripViewAlignment.Top: case StripViewAlignment.Bottom: if (itemLength > client.Width) { hiddenLength = itemLength - client.Width; } maxLength = client.Width; break; case StripViewAlignment.Left: case StripViewAlignment.Right: if (itemLength > client.Height) { hiddenLength = itemLength - client.Height; } maxLength = client.Height; break; } float scrollStep; if (scrollButtons == StripViewButtons.LeftScroll) { scrollStep = this.ScrollOffset; } else { scrollStep = hiddenLength - this.ScrollOffset; } return((int)Math.Min(maxLength, scrollStep)); }
protected override void OnPropertyChanged(RadPropertyChangedEventArgs e) { base.OnPropertyChanged(e); if (e.Property == StripAlignmentProperty) { this.UpdateItemOrientation(this.Items); this.UpdateItemContainer((StripViewAlignment)e.NewValue); if (this.SelectedItem != null && this.EnsureSelectedItemVisible) { this.EnsureItemVisible(this.SelectedItem); } } else if (e.Property == StripScrollingAnimationProperty) { this.itemContainer.ItemLayout.SetScrollAnimation((RadEasingType)e.NewValue); } else if (e.Property == AnimatedStripScrollingProperty) { this.itemContainer.ItemLayout.EnableScrolling((bool)e.NewValue); } else if (e.Property == StripButtonsProperty) { StripViewButtons buttons = (StripViewButtons)e.NewValue; if (buttons == StripViewButtons.None) { this.itemContainer.ButtonsPanel.Visibility = ElementVisibility.Collapsed; } else { this.itemContainer.ButtonsPanel.Visibility = ElementVisibility.Visible; } } else if (e.Property == NewItemVisibilityProperty) { this.UpdateNewItem(); } if (PropertyInvalidatesScrollOffset(e.Property) && this.EnsureSelectedItemVisible && this.SelectedItem != null) { this.itemContainer.ItemLayout.EnsureVisible(this.SelectedItem); } }
private void UpdateButtonsVisibility() { StripViewButtons buttons = (StripViewButtons)this.GetValue(RadPageViewStripElement.StripButtonsProperty); if (buttons == StripViewButtons.Auto) { buttons = this.GetAutoButtons(); } if ((buttons & StripViewButtons.LeftScroll) == StripViewButtons.LeftScroll) { this.scrollLeftButton.Visibility = ElementVisibility.Visible; } else { this.scrollLeftButton.Visibility = ElementVisibility.Collapsed; } if ((buttons & StripViewButtons.RightScroll) == StripViewButtons.RightScroll) { this.scrollRightButton.Visibility = ElementVisibility.Visible; } else { this.scrollRightButton.Visibility = ElementVisibility.Collapsed; } if ((buttons & StripViewButtons.ItemList) == StripViewButtons.ItemList) { this.itemListButton.Visibility = ElementVisibility.Visible; } else { this.itemListButton.Visibility = ElementVisibility.Collapsed; } if ((buttons & StripViewButtons.Close) == StripViewButtons.Close) { this.closeButton.Visibility = ElementVisibility.Visible; } else { this.closeButton.Visibility = ElementVisibility.Collapsed; } }
internal void Scroll(StripViewButtons button) { if (this.layoutInfo == null) { return; } if (this.layoutInfo.itemAlign == StripViewItemAlignment.Far ^ this.ShouldUseRightToLeft()) { button = this.FlipScrollButtons(button); } switch (button) { case StripViewButtons.LeftScroll: this.SetScrollOffset(this.ScrollOffset - this.GetScrollStep(this.PreviousConstraint, StripViewButtons.LeftScroll), true); break; case StripViewButtons.RightScroll: this.SetScrollOffset(this.ScrollOffset + this.GetScrollStep(this.PreviousConstraint, StripViewButtons.RightScroll), true); break; } }
protected internal override void SetContentOrientation(PageViewContentOrientation orientation, bool recursive) { StripViewButtons buttons = (StripViewButtons)this.Tag; switch (buttons) { //do not rotate scroll buttons by 270 degrees case StripViewButtons.LeftScroll: case StripViewButtons.RightScroll: if (orientation == PageViewContentOrientation.Vertical270) { orientation = PageViewContentOrientation.Vertical90; } break; //do not rotate close button case StripViewButtons.Close: orientation = PageViewContentOrientation.Horizontal; break; } base.SetContentOrientation(orientation, recursive); }
private StripViewButtons FlipScrollButtons(StripViewButtons buttons) { buttons = buttons != StripViewButtons.LeftScroll ? StripViewButtons.LeftScroll : StripViewButtons.RightScroll; return(buttons); }