// ------------------------------------------------------------ #region Constructors public RangeSliderView() { // Active Bar _activeBar = new BoxView(); _activeBar.SetBinding(BoxView.ColorProperty, new Binding(path: "ActiveBarColor", source: this)); AbsoluteLayout.SetLayoutFlags(_activeBar, AbsoluteLayoutFlags.None); this.Children.Add(_activeBar); // Inactive Left Bar _inActiveLeftBar = new BoxView(); _inActiveLeftBar.SetBinding(BoxView.ColorProperty, new Binding(path: "InactiveBarColor", source: this)); AbsoluteLayout.SetLayoutFlags(_inActiveLeftBar, AbsoluteLayoutFlags.None); this.Children.Add(_inActiveLeftBar); // Inactive Right Bar _inActiveRightBar = new BoxView(); _inActiveRightBar.SetBinding(BoxView.ColorProperty, new Binding(path: "InactiveBarColor", source: this)); AbsoluteLayout.SetLayoutFlags(_inActiveRightBar, AbsoluteLayoutFlags.None); this.Children.Add(_inActiveRightBar); // Left Button _leftButton = new Image(); AbsoluteLayout.SetLayoutFlags(_leftButton, AbsoluteLayoutFlags.None); var leftButtonPanGesture = new PanGestureRecognizer(); leftButtonPanGesture.PanUpdated += LeftButtonPanGesture; _leftButton.GestureRecognizers.Add(leftButtonPanGesture); _leftButton.SetBinding(Image.SourceProperty, new Binding(path: "HandleImageSource", source: this)); this.Children.Add(_leftButton); // Right Button _rightButton = new Image(); AbsoluteLayout.SetLayoutFlags(_rightButton, AbsoluteLayoutFlags.None); var rightButtonPanGesture = new PanGestureRecognizer(); rightButtonPanGesture.PanUpdated += RightButtonPanGesture; _rightButton.GestureRecognizers.Add(rightButtonPanGesture); _rightButton.SetBinding(Image.SourceProperty, new Binding(path: "HandleImageSource", source: this)); this.Children.Add(_rightButton); // Left Bubble _leftBubble = new RangeSliderBubble() { IsVisible = this.ShowBubbles, Text = this.LeftValue.ToString("#0") }; AbsoluteLayout.SetLayoutFlags(_leftBubble, AbsoluteLayoutFlags.None); _leftBubble.SetBinding(RangeSliderBubble.SourceProperty, new Binding(path: "BubbleImageSource", source: this)); _leftBubble.SetBinding(RangeSliderBubble.FontFamilyProperty, new Binding(path: "FontFamily", source: this)); _leftBubble.SetBinding(RangeSliderBubble.FontSizeProperty, new Binding(path: "FontSize", source: this)); _leftBubble.SetBinding(RangeSliderBubble.TextColorProperty, new Binding(path: "TextColor", source: this)); this.Children.Add(_leftBubble); // Right Bubble _rightBubble = new RangeSliderBubble() { IsVisible = this.ShowBubbles, Text = this.RightValue.ToString("#0") }; AbsoluteLayout.SetLayoutFlags(_rightBubble, AbsoluteLayoutFlags.None); _rightBubble.SetBinding(RangeSliderBubble.SourceProperty, new Binding(path: "BubbleImageSource", source: this)); _rightBubble.SetBinding(RangeSliderBubble.FontFamilyProperty, new Binding(path: "FontFamily", source: this)); _rightBubble.SetBinding(RangeSliderBubble.FontSizeProperty, new Binding(path: "FontSize", source: this)); _rightBubble.SetBinding(RangeSliderBubble.TextColorProperty, new Binding(path: "TextColor", source: this)); this.Children.Add(_rightBubble); }
public RangeSliderView() { // Active Bar _activeBar = new BoxView(); _activeBar.SetBinding(BoxView.ColorProperty, new Binding(path: "ActiveBarColor", source: this)); AbsoluteLayout.SetLayoutFlags(_activeBar, AbsoluteLayoutFlags.None); this.Children.Add(_activeBar); // Inactive Left Bar _inActiveLeftBar = new BoxView(); _inActiveLeftBar.SetBinding(BoxView.ColorProperty, new Binding(path: "InactiveBarColor", source: this)); AbsoluteLayout.SetLayoutFlags(_inActiveLeftBar, AbsoluteLayoutFlags.None); this.Children.Add(_inActiveLeftBar); // Inactive Right Bar _inActiveRightBar = new BoxView(); _inActiveRightBar.SetBinding(BoxView.ColorProperty, new Binding(path: "InactiveBarColor", source: this)); AbsoluteLayout.SetLayoutFlags(_inActiveRightBar, AbsoluteLayoutFlags.None); this.Children.Add(_inActiveRightBar); // Left Button _leftButton = new Image(); AbsoluteLayout.SetLayoutFlags(_leftButton, AbsoluteLayoutFlags.None); var leftButtonPanGesture = new PanGestureRecognizer(); leftButtonPanGesture.PanUpdated += LeftButtonPanGesture; _leftButton.GestureRecognizers.Add(leftButtonPanGesture); _leftButton.SetBinding(Image.SourceProperty, new Binding(path: "HandleImageSource", source: this)); this.Children.Add(_leftButton); // Right Button _rightButton = new Image(); AbsoluteLayout.SetLayoutFlags(_rightButton, AbsoluteLayoutFlags.None); var rightButtonPanGesture = new PanGestureRecognizer(); rightButtonPanGesture.PanUpdated += RightButtonPanGesture; _rightButton.GestureRecognizers.Add(rightButtonPanGesture); _rightButton.SetBinding(Image.SourceProperty, new Binding(path: "HandleImageSource", source: this)); this.Children.Add(_rightButton); // Left Bubble _leftBubble = new RangeSliderBubble() { IsVisible = this.ShowBubbles, Text = this.LeftValue.ToString("#0") }; AbsoluteLayout.SetLayoutFlags(_leftBubble, AbsoluteLayoutFlags.None); _leftBubble.SetBinding(RangeSliderBubble.SourceProperty, new Binding(path: "BubbleImageSource", source: this)); _leftBubble.SetBinding(RangeSliderBubble.FontFamilyProperty, new Binding(path: "FontFamily", source: this)); _leftBubble.SetBinding(RangeSliderBubble.FontSizeProperty, new Binding(path: "FontSize", source: this)); _leftBubble.SetBinding(RangeSliderBubble.TextColorProperty, new Binding(path: "TextColor", source: this)); this.Children.Add(_leftBubble); // Right Bubble _rightBubble = new RangeSliderBubble() { IsVisible = this.ShowBubbles, Text = this.RightValue.ToString("#0") }; AbsoluteLayout.SetLayoutFlags(_rightBubble, AbsoluteLayoutFlags.None); _rightBubble.SetBinding(RangeSliderBubble.SourceProperty, new Binding(path: "BubbleImageSource", source: this)); _rightBubble.SetBinding(RangeSliderBubble.FontFamilyProperty, new Binding(path: "FontFamily", source: this)); _rightBubble.SetBinding(RangeSliderBubble.FontSizeProperty, new Binding(path: "FontSize", source: this)); _rightBubble.SetBinding(RangeSliderBubble.TextColorProperty, new Binding(path: "TextColor", source: this)); this.Children.Add(_rightBubble); }