public override void OnApplyTemplate() { base.OnApplyTemplate(); _scrollViewer = GetTemplateChild(ScrollableListBoxVisualElements.ScrollViewer) as ScrollViewer; _fowardButtonElement = GetTemplateChild(ScrollableListBoxVisualElements.ForwardButtonElement) as RepeatButton; _backButtonElement = GetTemplateChild(ScrollableListBoxVisualElements.BackButtonElement) as RepeatButton; if (_fowardButtonElement != null) { if (IncrementDelay > TimeSpan.Zero) { _fowardButtonElement.Interval = (int) IncrementDelay.TotalMilliseconds; } _fowardButtonElement.Click += FowardButtonElement_Click; } if (_backButtonElement != null) { if (IncrementDelay > TimeSpan.Zero) { _backButtonElement.Interval = (int) IncrementDelay.TotalMilliseconds; } _backButtonElement.Click += BackButtonElement_Click; } }
public override void OnApplyTemplate() { base.OnApplyTemplate(); this.sliderElement = base.GetTemplateChild("ZoomSlider") as Slider; this.zoomInElement = base.GetTemplateChild("ZoomInElement") as RepeatButton; this.zoomOutElement = base.GetTemplateChild("ZoomOutElement") as RepeatButton; this.SetupZoom(); if (this.sliderElement != null) { sliderElement.MouseEnter += new MouseEventHandler(zoomSliderElement_MouseEnter); sliderElement.MouseLeave += new MouseEventHandler(zoomSliderElement_MouseLeave); this.sliderElement.ValueChanged += new RoutedPropertyChangedEventHandler<double>(this.ZoomSlider_ValueChanged); } if (this.zoomInElement != null) { this.zoomInElement.Click += new RoutedEventHandler(this.ZoomInButton_Click); } if (this.zoomOutElement != null) { this.zoomOutElement.Click += new RoutedEventHandler(this.ZoomOutButton_Click); } }
public override void OnApplyTemplate() { base.OnApplyTemplate(); IncrRButton = (RepeatButton) GetTemplateChild("IncreaseRepeatButton"); DecrRButton = (RepeatButton) GetTemplateChild("DecreaseRepeatButton"); DecrRButton.Click += DecrRButton_Click; IncrRButton.Click += IncrRButton_Click; }
/// <summary> /// テンプレート適用時の処理 /// </summary> public override void OnApplyTemplate() { base.OnApplyTemplate(); this.InputTextBox = this.Template.FindName(PART_InputTextBox, this) as TextBox; this.UpButton = this.Template.FindName(PART_UpButton, this) as RepeatButton; this.DownButton = this.Template.FindName(PART_DownButton, this) as RepeatButton; UpdateTextFromValue(); }
private void GetTemplateChildren() { _horizontalPanel = GetTemplateChild(TimelineTemplateParts.HorizontalTemplate) as Panel; _horizontalThumb = GetTemplateChild(TimelineTemplateParts.HorizontalThumb) as Thumb; _horizontalAvailableBar = GetTemplateChild(TimelineTemplateParts.HorizontalAvailableBar) as Border; _largeChangeIncreaseButton = GetTemplateChild(TimelineTemplateParts.HorizontalTrackLargeChangeDecreaseRepeatButton) as RepeatButton; _largeChangeDecreaseButton = GetTemplateChild(TimelineTemplateParts.HorizontalTrackLargeChangeIncreaseRepeatButton) as RepeatButton; }
public GetVisualChildTrack () { Thumb = new Thumb (); Assert.AreEqual (GetVisualChild (0), Thumb, "GetVisualChild(0) 1"); DecreaseRepeatButton = new RepeatButton (); Assert.AreEqual (GetVisualChild (0), Thumb, "GetVisualChild(0) 2"); Thumb = Thumb; Assert.AreEqual (GetVisualChild (0), Thumb, "GetVisualChild(0) 2"); Thumb = new Thumb (); Assert.AreEqual (GetVisualChild (0), DecreaseRepeatButton, "GetVisualChild(0) 3"); }
public void OnPostInit() #endif { _prevButton = (RepeatButton)FindName("PrevButton"); _nextButton = (RepeatButton)FindName("NextButton"); _prevButton.Click += OnPrev; _nextButton.Click += OnNext; UpdateSelectedOption(); UpdateButtons(); }
public void Delay () { RepeatButton rb = new RepeatButton (); Assert.Throws<ArgumentException> (delegate { rb.Delay = -1; }, "negative"); Assert.AreEqual (-1, rb.Delay, "changed after exception"); rb.Delay = 0; Assert.AreEqual (0, rb.Delay, "0"); rb.Delay = Int32.MaxValue; Assert.AreEqual (Int32.MaxValue, rb.Delay, "MaxValue"); }
/// <summary> /// The on apply template. /// </summary> public override void OnApplyTemplate() { base.OnApplyTemplate(); this.minusButton = (RepeatButton)this.GetTemplateChild("PART_MinusButton"); this.plusButton = (RepeatButton)this.GetTemplateChild("PART_PlusButton"); if (this.minusButton != null) { this.minusButton.Click += this.minusButton_Click; } if (this.plusButton != null) { this.plusButton.Click += this.plusButton_Click; } }
public void InvalidValues () { RepeatButton repeat_button = new RepeatButton (); const int minimum_delay = 0; repeat_button.SetValue (RepeatButton.DelayProperty, minimum_delay); try { repeat_button.SetValue (RepeatButton.DelayProperty, minimum_delay - 1); Assert.Fail ("Delay"); } catch (ArgumentException) { } const int minimum_interval = 1; repeat_button.SetValue (RepeatButton.IntervalProperty, minimum_interval); try { repeat_button.SetValue (RepeatButton.IntervalProperty, minimum_interval - 1); Assert.Fail ("Interval"); } catch (ArgumentException) { } }
public void Delay_SetValue () { RepeatButton rb = new RepeatButton (); Assert.Throws<ArgumentException> (delegate { rb.SetValue (RepeatButton.DelayProperty, -1); }, "negative"); Assert.AreEqual (-1, rb.Delay, "changed after exception"); rb.SetValue (RepeatButton.DelayProperty, 0); Assert.AreEqual (0, rb.Delay, "0"); rb.SetValue (RepeatButton.DelayProperty, Int32.MaxValue); Assert.AreEqual (Int32.MaxValue, rb.Delay, "MaxValue"); Assert.Throws<ArgumentException> (delegate { rb.SetValue (RepeatButton.DelayProperty, null); }, "non-int"); Assert.AreEqual (Int32.MaxValue, rb.Delay, "unchanged"); }
public override void OnApplyTemplate() { base.OnApplyTemplate(); this.tabLeftButton = GetTemplateChild("TabLeftButtonTop") as RepeatButton; this.tabRightButton = GetTemplateChild("TabRightButtonTop") as RepeatButton; this.tabScrollViewer = GetTemplateChild("TabScrollViewerTop") as ScrollViewer; this.tabPanelTop = GetTemplateChild("TabPanelTop") as TabPanel; this.tabAddItemButton = GetTemplateChild("TabAddItemButton") as Button; if (this.tabLeftButton != null) this.tabLeftButton.Click += tabLeftButton_Click; if (this.tabRightButton != null) this.tabRightButton.Click += tabRightButton_Click; if (this.tabAddItemButton != null) this.tabAddItemButton.Click += tabAddItemButton_Click; }
/// <summary> /// Initializes a new instance of the <see cref="Track"/> class. /// </summary> /// <param name="uv">The Ultraviolet context.</param> /// <param name="name">The element's identifying name within its namescope.</param> public Track(UltravioletContext uv, String name) : base(uv, name) { this.Thumb = new Button(uv, null) { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, Focusable = false, }; this.Thumb.Classes.Add("track-thumb"); this.Thumb.ChangeLogicalAndVisualParents(this, this); KeyboardNavigation.SetIsTabStop(this.Thumb, false); this.IncreaseButton = new RepeatButton(uv, null) { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, Opacity = 0, Focusable = false, }; this.IncreaseButton.Classes.Add("track-increase"); this.IncreaseButton.Click += HandleIncreaseButtonClick; this.IncreaseButton.ChangeLogicalAndVisualParents(this, this); KeyboardNavigation.SetIsTabStop(this.IncreaseButton, false); this.DecreaseButton = new RepeatButton(uv, null) { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, Opacity = 0, Focusable = false, }; this.DecreaseButton.Classes.Add("track-decrease"); this.DecreaseButton.Click += HandleDecreaseButtonClick; this.DecreaseButton.ChangeLogicalAndVisualParents(this, this); KeyboardNavigation.SetIsTabStop(this.DecreaseButton, false); Mouse.AddPreviewMouseMoveHandler(this.Thumb, HandleThumbPreviewMouseMove); Mouse.AddPreviewMouseDownHandler(this.Thumb, HandleThumbPreviewMouseDown); Mouse.AddPreviewMouseUpHandler(this.Thumb, HandleThumbPreviewMouseUp); }
protected override Size MeasureOverride(Size constraint) { if (_btnLeft == null) _btnLeft = this.FindName("PART_Left") as RepeatButton; if (_btnRight == null) _btnRight = this.FindName("PART_Right") as RepeatButton; _S = this.ActualWidth; if (_L > _S) { _x1 = _S; _x0 = _S - _L; m_transform.X = _x0; } else { _x0 = _O; _x1 = _L; m_transform.X = _x0; } offset = 0.0; UpdateState(); return base.MeasureOverride(constraint); }
public override void OnApplyTemplate() { base.OnApplyTemplate(); m_menuOptionsView = (ScrollViewer)GetTemplateChild("MenuOptionsView"); m_resultsOptionsView = (ScrollViewer)GetTemplateChild("ResultsMenuOptionsView"); m_resultsOptionsView.TouchDown += OnResultsListTouchDown; m_resultsOptionsView.TouchUp += OnResultsListTouchUp; m_resultsOptionsView.ManipulationBoundaryFeedback += OnResultsListBoundaryFeedback; m_resultsOptionsView.ScrollChanged += OnSearchResultsScrolled; m_resultsSpinner = (Grid)GetTemplateChild("SearchResultsSpinner"); m_resultsCount = (TextBlock)GetTemplateChild("SearchResultCount"); m_resultsCountContainer = (Grid)GetTemplateChild("SearchResultCountContainer"); m_menuViewContainer = (Grid)GetTemplateChild("SearchMenuViewContainer"); m_backgroundRectangle = (Rectangle)GetTemplateChild("BackgroundRect"); m_searchBox = (Grid)GetTemplateChild("SearchBox"); m_searchArrow = (FrameworkElement)GetTemplateChild("SearchArrow"); m_resultsSeparator = (FrameworkElement)GetTemplateChild("ResultsListSeparator"); m_searchResultsFade = (Image)GetTemplateChild("SearchResultsFade"); m_searchResultsButtonAndFadeContainer = (Grid)GetTemplateChild("SearchResultsButtonAndFadeContainer"); m_searchResultsScrollButton = (RepeatButton)GetTemplateChild("SearchResultsScrollButton"); m_searchResultsScrollButton.Click += OnResultsScrollButtonMouseDown; m_searchResultsScrollButton.PreviewMouseWheel += OnResultsMenuScrollWheel; m_resultsClearButton = (Button)GetTemplateChild("SearchClear"); m_resultsClearButton.Click += OnResultsClear; m_list = (ListBox)GetTemplateChild("SecondaryMenuItemList"); m_menuListClickHandler = new ControlClickHandler(OnMenuListItemSelected, m_list); m_list.PreviewMouseWheel += OnMenuScrollWheel; m_resultsList = (ListBox)GetTemplateChild("SearchResultsList"); m_resultsListClickHandler = new ControlClickHandler(OnResultsListItemsSelected, m_resultsList); m_resultsList.PreviewMouseWheel += OnResultsMenuScrollWheel; m_menuIcon = (Button)GetTemplateChild("SecondaryMenuDragTabView"); m_menuIconGrid = (Grid)GetTemplateChild("SearchIconGrid"); m_menuIcon.Click += OnIconClick; m_editText = (TextBox)GetTemplateChild("SearchInputBox"); m_editText.KeyDown += OnKeyDown; m_editText.GotFocus += OnSearchBoxSelected; m_editText.LostFocus += OnSearchBoxUnSelected; m_editText.TextChanged += OnSearchBoxTextChanged; m_mainContainer = (Grid)GetTemplateChild("SerchMenuMainContainer"); var itemShutterOpenStoryboard = ((Storyboard)Template.Resources["ItemShutterOpen"]).Clone(); var itemShutterCloseStoryboard = ((Storyboard)Template.Resources["ItemShutterClose"]).Clone(); var slideInItemStoryboard = ((Storyboard)Template.Resources["SlideInNewItems"]).Clone(); var slideOutItemStoryboard = ((Storyboard)Template.Resources["SlideOutOldItems"]).Clone(); m_openSearchIconAnim = ((Storyboard)Template.Resources["OpenSearchViewIcon"]).Clone(); m_closeMenuIconAnim = ((Storyboard)Template.Resources["CloseSearchViewIcon"]).Clone(); m_openSearchContainerAnim = ((Storyboard)Template.Resources["OpenSearchContainer"]).Clone(); m_closeMenuContainerAnim = ((Storyboard)Template.Resources["CloseSearchContainer"]).Clone(); m_openBackgroundRect = ((Storyboard)Template.Resources["OpenBackgroundRect"]).Clone(); m_closeBackgroundRect = ((Storyboard)Template.Resources["CloseBackgroundRect"]).Clone(); m_searchInputOpen = ((Storyboard)Template.Resources["OpenSearchInputBox"]).Clone(); m_searchInputClose = ((Storyboard)Template.Resources["CloseSearchInputBox"]).Clone(); m_searchInputTextOpen = ((Storyboard)Template.Resources["OpenSearchInputBoxText"]).Clone(); m_searchInputTextClose = ((Storyboard)Template.Resources["CloseSearchInputBoxText"]).Clone(); m_searchArrowOpen = ((Storyboard)Template.Resources["OpenSearchArrow"]).Clone(); m_searchArrowClosed = ((Storyboard)Template.Resources["CloseSearchArrow"]).Clone(); m_adapter = new MenuListAdapter(false, m_list, slideInItemStoryboard, slideOutItemStoryboard, itemShutterOpenStoryboard, itemShutterCloseStoryboard, "SubMenuItemPanel"); m_resultListAdapter = new MenuListAdapter(false, m_resultsList, slideInItemStoryboard, slideOutItemStoryboard, itemShutterOpenStoryboard, itemShutterCloseStoryboard, "SearchResultPanel"); }
public override void OnApplyTemplate() { base.OnApplyTemplate(); if (_lowerRange != null) { _lowerRange.Click -= new RoutedEventHandler(this.LowerRange_Click); } _lowerRange = this.Template.FindName(PART_LowerRange, this) as RepeatButton; if (_lowerRange != null) { _lowerRange.Click += new RoutedEventHandler(this.LowerRange_Click); } if (_higherRange != null) { _higherRange.Click -= new RoutedEventHandler(this.HigherRange_Click); } _higherRange = this.Template.FindName(PART_HigherRange, this) as RepeatButton; if (_higherRange != null) { _higherRange.Click += new RoutedEventHandler(this.HigherRange_Click); } if( _lowerSlider != null ) { _lowerSlider.Loaded -= this.Slider_Loaded; _lowerSlider.ValueChanged -= LowerSlider_ValueChanged; } _lowerSlider = this.Template.FindName( PART_LowerSlider, this ) as Slider; if( _lowerSlider != null ) { _lowerSlider.Loaded += this.Slider_Loaded; _lowerSlider.ValueChanged += LowerSlider_ValueChanged; } if( _higherSlider != null ) { _higherSlider.Loaded -= this.Slider_Loaded; _higherSlider.ValueChanged -= HigherSlider_ValueChanged; } _higherSlider = this.Template.FindName( PART_HigherSlider, this ) as Slider; if( _higherSlider != null ) { _higherSlider.Loaded += this.Slider_Loaded; _higherSlider.ValueChanged += HigherSlider_ValueChanged; } }
public override void OnApplyTemplate() { base.OnApplyTemplate(); this._elementRootTemplate = this.GetTemplateChild("Root") as FrameworkElement; this._elementHorizontalTemplate = this.GetTemplateChild("HorizontalRoot") as FrameworkElement; this._elementHorizontalLargeIncrease = this.GetTemplateChild("HorizontalLargeIncrease") as RepeatButton; this._elementHorizontalLargeDecrease = this.GetTemplateChild("HorizontalLargeDecrease") as RepeatButton; this._elementHorizontalSmallIncrease = this.GetTemplateChild("HorizontalSmallIncrease") as RepeatButton; this._elementHorizontalSmallDecrease = this.GetTemplateChild("HorizontalSmallDecrease") as RepeatButton; this._elementHorizontalThumb = this.GetTemplateChild("HorizontalThumb") as Thumb; this._elementHorizontalThumbResizeInc = this.GetTemplateChild("HorizontalThumbResizeIncrease") as Thumb; this._elementHorizontalThumbResizeDec = this.GetTemplateChild("HorizontalThumbResizeDecrease") as Thumb; this._elementVerticalTemplate = this.GetTemplateChild("VerticalRoot") as FrameworkElement; this._elementVerticalLargeIncrease = this.GetTemplateChild("VerticalLargeIncrease") as RepeatButton; this._elementVerticalLargeDecrease = this.GetTemplateChild("VerticalLargeDecrease") as RepeatButton; this._elementVerticalSmallIncrease = this.GetTemplateChild("VerticalSmallIncrease") as RepeatButton; this._elementVerticalSmallDecrease = this.GetTemplateChild("VerticalSmallDecrease") as RepeatButton; this._elementVerticalThumb = this.GetTemplateChild("VerticalThumb") as Thumb; this._elementVerticalThumbResizeInc = this.GetTemplateChild("VerticalThumbResizeIncrease") as Thumb; this._elementVerticalThumbResizeDec = this.GetTemplateChild("VerticalThumbResizeDecrease") as Thumb; this._elementMinimizeVisualState = this.GetTemplateChild("MinimizeState") as VisualState; this._elementMaximizeVisualState = this.GetTemplateChild("MaximizeState") as VisualState; if (this._elementHorizontalThumb != null) { this._elementHorizontalThumb.DragStarted += (DragStartedEventHandler)((s, e) => this.OnThumbDragStarted()); this._elementHorizontalThumb.DragDelta += (DragDeltaEventHandler)((s, e) => this.OnThumbDragDelta(e)); this._elementHorizontalThumb.DragCompleted += (DragCompletedEventHandler)((s, e) => this.OnThumbDragCompleted()); } this.AttachClickEventToRepeatButton(this._elementHorizontalLargeDecrease, new Action(this.LargeDecrement)); this.AttachClickEventToRepeatButton(this._elementHorizontalLargeIncrease, new Action(this.LargeIncrement)); this.AttachClickEventToRepeatButton(this._elementHorizontalSmallDecrease, new Action(this.SmallDecrement)); this.AttachClickEventToRepeatButton(this._elementHorizontalSmallIncrease, new Action(this.SmallIncrement)); this.AttachDragResizeEventToTumb(this._elementHorizontalThumbResizeDec); this.AttachDragResizeEventToTumb(this._elementHorizontalThumbResizeInc); if (this._elementVerticalThumb != null) { this._elementVerticalThumb.DragStarted += (DragStartedEventHandler)((s, e) => this.OnThumbDragStarted()); this._elementVerticalThumb.DragDelta += (DragDeltaEventHandler)((s, e) => this.OnThumbDragDelta(e)); this._elementVerticalThumb.DragCompleted += (DragCompletedEventHandler)((s, e) => this.OnThumbDragCompleted()); } this.AttachClickEventToRepeatButton(this._elementVerticalLargeDecrease, new Action(this.LargeDecrement)); this.AttachClickEventToRepeatButton(this._elementVerticalLargeIncrease, new Action(this.LargeIncrement)); this.AttachClickEventToRepeatButton(this._elementVerticalSmallDecrease, new Action(this.SmallDecrement)); this.AttachClickEventToRepeatButton(this._elementVerticalSmallIncrease, new Action(this.SmallIncrement)); this.AttachDragResizeEventToTumb(this._elementVerticalThumbResizeDec); this.AttachDragResizeEventToTumb(this._elementVerticalThumbResizeInc); this.OnOrientationPropertyChanged(this.Orientation, this.Orientation); this.SetGrowAnimationParams(this._elementMinimizeVisualState, this.MinimizedSize); this.SetGrowAnimationParams(this._elementMaximizeVisualState, this.MaximizedSize); this.UpdateVisualState(false); }
public void IsPressed () { RepeatButton repeat_button = new RepeatButton (); Assert.IsNull (RepeatButton.IsPressedProperty.DefaultMetadata.PropertyChangedCallback, "RepeatButton.IsPressedProperty.DefaultMetadata.PropertyChangedCallback"); }
public WindowsSpinButton() { this.Loaded += UserControl_Loaded; //MainGrid mainGrid = new Grid(); mainGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); mainGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(16) }); //Textbox textBox = new TextBox(); textBox.Text = "0"; textBox.HorizontalAlignment = HorizontalAlignment.Stretch; textBox.MinWidth = 25; textBox.PreviewKeyDown += textBox_PreviewKeyDown; textBox.PreviewKeyUp += textBox_PreviewKeyUp; textBox.MouseWheel += textBox_MouseWheel; mainGrid.Children.Add(textBox); //ButtonsGrid Grid buttonsGrid = new Grid(); buttonsGrid.ClipToBounds = false; buttonsGrid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) }); buttonsGrid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) }); buttonUp = new RepeatButton(); buttonUp.Focusable = false; buttonsGrid.Children.Add(buttonUp); Grid.SetRow(buttonUp, 0); buttonUp.Click += ButtonUp_Click; buttonUp.Interval = 20; buttonUp.Delay = 400; buttonUp.MouseRightButtonUp += buttonUp_MouseRightButtonUp; buttonUp.PreviewMouseLeftButtonDown += buttonUp_PreviewMouseLeftButtonDown; var buttonUpPolygonPoints = new PointCollection(3); buttonUpPolygonPoints.Add(new System.Windows.Point(0, 5)); buttonUpPolygonPoints.Add(new System.Windows.Point(3, 0)); buttonUpPolygonPoints.Add(new System.Windows.Point(6, 5)); buttonUp.Content = new Polygon() { Points = buttonUpPolygonPoints, Fill = Brushes.Black, SnapsToDevicePixels = true, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center }; buttonDown = new RepeatButton(); buttonDown.Focusable = false; buttonsGrid.Children.Add(buttonDown); Grid.SetRow(buttonDown, 1); buttonDown.Click += ButtonDown_Click; buttonDown.Interval = 20; buttonDown.Delay = 400; buttonDown.MouseRightButtonUp += buttonDown_MouseRightButtonUp; buttonDown.PreviewMouseLeftButtonDown += buttonDown_PreviewMouseLeftButtonDown; var buttonDownPolygonPoints = new PointCollection(3); buttonDownPolygonPoints.Add(new System.Windows.Point(0, 0)); buttonDownPolygonPoints.Add(new System.Windows.Point(3, 5)); buttonDownPolygonPoints.Add(new System.Windows.Point(6, 0)); buttonDown.Content = new Polygon() { Points = buttonDownPolygonPoints, Fill = Brushes.Black, SnapsToDevicePixels = true, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center }; mainGrid.Children.Add(buttonsGrid); Grid.SetColumn(buttonsGrid, 1); Content = mainGrid; }
public override void OnApplyTemplate() { base.OnApplyTemplate(); m_menuOptionsView = (ScrollViewer)GetTemplateChild("MenuOptionsView"); m_resultsSpinner = (Grid)GetTemplateChild("SearchResultsSpinner"); m_resultsCount = (TextBlock)GetTemplateChild("SearchResultCount"); m_resultsCountContainer = (Grid)GetTemplateChild("SearchResultCountContainer"); m_menuViewContainer = (Grid)GetTemplateChild("SearchMenuViewContainer"); m_backgroundRectangle = (Rectangle)GetTemplateChild("BackgroundRect"); m_searchBox = (Grid)GetTemplateChild("SearchBox"); m_searchArrow = (FrameworkElement)GetTemplateChild("SearchArrow"); m_resultsSeparator = (FrameworkElement)GetTemplateChild("ResultsListSeparator"); m_searchResultsFade = (Image)GetTemplateChild("SearchResultsFade"); m_searchResultsButtonAndFadeContainer = (Grid)GetTemplateChild("SearchResultsButtonAndFadeContainer"); m_searchResultsScrollButton = (RepeatButton)GetTemplateChild("SearchResultsScrollButton"); m_searchResultsScrollButton.Click += OnResultsScrollButtonMouseDown; m_searchResultsScrollButton.PreviewMouseWheel += OnResultsMenuScrollWheel; m_searchResultsScrollButton.MouseUp += OnResultsScrollButtonMouseUp; m_searchResultsScrollButton.MouseLeave += OnResultsScrollButtonMouseLeave; m_resultsClearButton = (Button)GetTemplateChild("SearchClear"); m_resultsClearButton.Click += OnResultsClear; m_list = (ListBox)GetTemplateChild("SecondaryMenuItemList"); m_menuListClickHandler = new ControlClickHandler(OnMenuListItemSelected, m_list); m_list.PreviewMouseWheel += OnMenuScrollWheel; m_resultsList = (ListBox)GetTemplateChild("SearchResultsList"); m_resultsList.TouchDown += new EventHandler <TouchEventArgs>(OnSearchResultsListTouchDown); m_resultsList.TouchUp += new EventHandler <TouchEventArgs>(OnSearchResultsListTouchUp); m_resultsList.TouchLeave += new EventHandler <TouchEventArgs>(OnSearchResultsListTouchLeave); m_resultsList.LostTouchCapture += new EventHandler <TouchEventArgs>(OnSearchResultsListLostTouchCapture); m_resultsListClickHandler = new ControlClickHandler(OnResultsListItemsSelected, m_resultsList); m_resultsList.PreviewMouseWheel += OnResultsMenuScrollWheel; m_menuIcon = (Button)GetTemplateChild("SecondaryMenuDragTabView"); m_menuIconGrid = (Grid)GetTemplateChild("SearchIconGrid"); m_menuIcon.Click += OnIconClick; m_editText = (TextBox)GetTemplateChild("SearchInputBox"); m_editText.KeyDown += OnKeyDown; m_editText.GotFocus += OnSearchBoxSelected; m_editText.LostFocus += OnSearchBoxUnSelected; m_editText.TextChanged += OnSearchBoxTextChanged; m_mainContainer = (Grid)GetTemplateChild("SerchMenuMainContainer"); var itemShutterOpenStoryboard = ((Storyboard)Template.Resources["ItemShutterOpen"]).Clone(); var itemShutterCloseStoryboard = ((Storyboard)Template.Resources["ItemShutterClose"]).Clone(); var slideInItemStoryboard = ((Storyboard)Template.Resources["SlideInNewItems"]).Clone(); var slideOutItemStoryboard = ((Storyboard)Template.Resources["SlideOutOldItems"]).Clone(); string searchAnimString = "SearchAnim"; string openMenuViewIconString = "OpenSearchViewIcon"; m_openMenuIconAnim = ((Storyboard)Template.Resources[openMenuViewIconString]).Clone(); XamlHelpers.UpdateThicknessAnimationMarginValue(m_openMenuIconAnim, searchAnimString + openMenuViewIconString); string closeMenuViewIconString = "CloseSearchViewIcon"; m_closeMenuIconAnim = ((Storyboard)Template.Resources[closeMenuViewIconString]).Clone(); XamlHelpers.UpdateThicknessAnimationMarginValue(m_closeMenuIconAnim, searchAnimString + closeMenuViewIconString); string openMenuContainerString = "OpenSearchContainer"; m_openMenuContainerAnim = ((Storyboard)Template.Resources[openMenuContainerString]).Clone(); XamlHelpers.UpdateThicknessAnimationMarginValue(m_openMenuContainerAnim, searchAnimString + openMenuContainerString); string closeMenuContainerString = "CloseSearchContainer"; m_closeMenuContainerAnim = ((Storyboard)Template.Resources[closeMenuContainerString]).Clone(); XamlHelpers.UpdateThicknessAnimationMarginValue(m_closeMenuContainerAnim, searchAnimString + closeMenuContainerString); string openBackgroundRectString = "OpenBackgroundRect"; m_openBackgroundRect = ((Storyboard)Template.Resources[openBackgroundRectString]).Clone(); XamlHelpers.UpdateThicknessAnimationMarginValue(m_openBackgroundRect, searchAnimString + openBackgroundRectString); string closeBackgroundRectString = "CloseBackgroundRect"; m_closeBackgroundRect = ((Storyboard)Template.Resources[closeBackgroundRectString]).Clone(); XamlHelpers.UpdateThicknessAnimationMarginValue(m_closeBackgroundRect, searchAnimString + closeBackgroundRectString); string openSearchInputBoxString = "OpenSearchInputBox"; m_searchInputOpen = ((Storyboard)Template.Resources[openSearchInputBoxString]).Clone(); XamlHelpers.UpdateThicknessAnimationMarginValue(m_searchInputOpen, searchAnimString + openSearchInputBoxString); m_searchInputClose = ((Storyboard)Template.Resources["CloseSearchInputBox"]).Clone(); m_searchInputTextOpen = ((Storyboard)Template.Resources["OpenSearchInputBoxText"]).Clone(); m_searchInputTextClose = ((Storyboard)Template.Resources["CloseSearchInputBoxText"]).Clone(); string openSearchArrowString = "OpenSearchArrow"; m_searchArrowOpen = ((Storyboard)Template.Resources[openSearchArrowString]).Clone(); XamlHelpers.UpdateThicknessAnimationMarginValue(m_searchArrowOpen, searchAnimString + openSearchArrowString); string closeSearchArrowString = "CloseSearchArrow"; m_searchArrowClosed = ((Storyboard)Template.Resources[closeSearchArrowString]).Clone(); XamlHelpers.UpdateThicknessAnimationMarginValue(m_searchArrowClosed, searchAnimString + closeSearchArrowString); m_adapter = new MenuListAdapter(false, m_list, slideInItemStoryboard, slideOutItemStoryboard, itemShutterOpenStoryboard, itemShutterCloseStoryboard, "SubMenuItemPanel", m_isInKioskMode); m_resultListAdapter = new MenuListAdapter(false, m_resultsList, slideInItemStoryboard, slideOutItemStoryboard, itemShutterOpenStoryboard, itemShutterCloseStoryboard, "SearchResultPanel", m_isInKioskMode); m_scrollSpeed = (double)Application.Current.Resources["ScrollViewButtonScrollSpeed"]; m_searchIconOffImageSource = (ImageSource)Application.Current.Resources["ButtonSearchOffImage"]; m_searchIconOnImageSource = (ImageSource)Application.Current.Resources["ButtonSearchOnImage"]; m_closeIconOffImageSource = (ImageSource)Application.Current.Resources["ButtonSearchCloseOffImage"]; m_closeIconOnImageSource = (ImageSource)Application.Current.Resources["ButtonSearchCloseOnImage"]; SearchMenuIconOffImageSource = m_searchIconOffImageSource; SearchMenuIconOnImageSource = m_searchIconOnImageSource; }
public override void OnApplyTemplate() { base.OnApplyTemplate(); m_spectrumDisplay = GetTemplateChild(SpectrumDisplayName) as Rectangle; m_Thumb = GetTemplateChild("Thumb") as ColorThumb; m_IncreaseRepeatButton = GetTemplateChild("PART_IncreaseButton") as RepeatButton; m_DecreaseRepeatButton = GetTemplateChild("PART_DecreaseButton") as RepeatButton; updateColorSpectrum(); OnValueChanged(Double.NaN, Value); }
//public MediaPlayerViewCtr(string mediaUrl) //{ // MediaUrl = mediaUrl; // _viewModel = new MediaPlayerViewModel(); // _viewModel.Init(mediaUrl); //} public override void ViewDidLoad() { base.ViewDidLoad(); _viewModel.PropertyChanged += (sender, args) => { var propertyName = args.PropertyName; var allChanged = propertyName == null; Func <string, bool> hasChanged = property => allChanged || propertyName == property; InvokeOnMainThread(() => { if (hasChanged(nameof(MediaPlayerViewModel.PlayingText))) { QueueLabel.Text = _viewModel.PlayingText; } if (hasChanged(nameof(MediaPlayerViewModel.Cover))) { TrackCoverImageView.Image = (UIImage)_viewModel.Cover; } if (hasChanged(nameof(MediaPlayerViewModel.CurrentTrack))) { TitleLabel.Text = _viewModel.CurrentTrack.Metadata.Title; SubtitleLabel.Text = _viewModel.CurrentTrack.Metadata.Artist; } if (hasChanged(nameof(MediaPlayerViewModel.IsPlaying))) { PlayPauseButton.Selected = _viewModel.IsPlaying; } if (hasChanged(nameof(MediaPlayerViewModel.Duration))) { PlayingProgressSlider.MaxValue = _viewModel.Duration; BufferedProgressSlider.MaxValue = _viewModel.Duration; var duration = TimeSpan.FromSeconds(_viewModel.Duration); TimeTotalLabel.Text = GetTimeString(duration); } if (hasChanged(nameof(MediaPlayerViewModel.Position))) { PlayingProgressSlider.Value = _viewModel.Position; TimePlayedLabel.Text = GetTimeString(TimeSpan.FromSeconds(_viewModel.Position)); } if (hasChanged(nameof(MediaPlayerViewModel.Downloaded))) { BufferedProgressSlider.Value = _viewModel.Downloaded; } }); }; MediaPlayer.PlayingChanged += (sender, args) => { if (!_viewModel.IsSeeking) { InvokeOnMainThread(() => { TimePlayedLabel.Text = GetTimeString(args.Position); }); } }; MediaPlayer.MediaQueue.PropertyChanged += (sender, e) => { InvokeOnMainThread(() => { var propertyName = e.PropertyName; var allChanged = propertyName == null; Func <string, bool> hasChanged = property => allChanged || propertyName == property; if (hasChanged(nameof(MediaPlayer.MediaQueue.IsShuffled))) { ShuffleButton.Selected = MediaPlayer.MediaQueue.IsShuffled; } if (hasChanged(nameof(MediaPlayer.MediaQueue.Repeat))) { var iconPrefix = "icon_repeat_"; var extension = ".png"; string iconState; switch (MediaPlayer.MediaQueue.Repeat) { case RepeatType.None: iconState = "static"; break; case RepeatType.RepeatAll: iconState = "active"; break; case RepeatType.RepeatOne: iconState = "one_active"; break; default: iconState = "static"; break; } var imageUrl = iconPrefix + iconState + extension; var image = new UIImage(imageUrl); RepeatButton.SetImage(image, UIControlState.Normal); } }); }; PlayingProgressSlider.TouchDown += (sender, e) => { _viewModel.IsSeeking = true; }; PlayingProgressSlider.TouchUpInside += (sender, e) => { _viewModel.IsSeeking = false; }; PlayingProgressSlider.TouchUpOutside += (sender, e) => { _viewModel.IsSeeking = false; }; PlayingProgressSlider.ValueChanged += (sender, e) => { _viewModel.IsSeeking = true; _viewModel.Position = (int)PlayingProgressSlider.Value; }; PlayingProgressSlider.Continuous = true; PlayPauseButton.TouchUpInside += async(sender, e) => { await PlaybackController.PlayPause(); PlayPauseButton.Selected = _viewModel.IsPlaying; }; NextButton.TouchUpInside += async(sender, e) => { await PlaybackController.PlayNext(); }; PreviousButton.TouchUpInside += async(sender, e) => { await PlaybackController.PlayPrevious(); }; ShuffleButton.TouchUpInside += (sender, args) => { PlaybackController.ToggleShuffle(); }; RepeatButton.TouchUpInside += (sender, e) => { PlaybackController.ToggleRepeat(); }; _viewModel.Init(); var sampleFilePath = NSBundle.MainBundle.PathForResource("local-sample", "mp4"); _viewModel.Queue.Add(new MediaFile { Type = MediaFileType.Video, Url = sampleFilePath, Availability = ResourceAvailability.Local }); }
private void przycisk_mruganie(RepeatButton przycisk) { Dispatcher.BeginInvoke(new Action(() => { przycisk.Background = new SolidColorBrush(Color.FromArgb(0xFF, 0x22, 0x64, 0x9C)); })); }
public static IObservable <EventPattern <EventArgs> > InitializedObserver(this RepeatButton This) { return(Observable.FromEventPattern <EventHandler, EventArgs>(h => This.Initialized += h, h => This.Initialized -= h)); }
public static IObservable <EventPattern <DependencyPropertyChangedEventArgs> > FocusableChangedObserver(this RepeatButton This) { return(Observable.FromEventPattern <DependencyPropertyChangedEventHandler, DependencyPropertyChangedEventArgs>(h => This.FocusableChanged += h, h => This.FocusableChanged -= h)); }
Grid _Toolbar() { var grid = new Grid { ColumnHomogeneous = true, MarginLeft = 10, MarginRight = 10 }; var task_status = new TaskStatusIcon { ShowOnlyBackgroundTasks = false }; var toolbar = (Toolbar)ActionService.UIManager.GetWidget("/ControlToolbar"); toolbar.ShowArrow = false; toolbar.ToolbarStyle = ToolbarStyle.Icons; toolbar.IconSize = IconSize.SmallToolbar; toolbar.Margin = 0; var next_button = new NextButton(ActionService) { IconSize = IconSize.SmallToolbar }; ActionService.PopulateToolbarPlaceholder(toolbar, "/ControlToolbar/NextArrowButton", next_button); var repeat_button = new RepeatButton { Relief = ReliefStyle.None }; ActionService.PopulateToolbarPlaceholder(toolbar, "/ControlToolbar/RepeatButton", repeat_button); var seek_slider = new ConnectedSeekSlider(); var tools_align = new Alignment(0.5f, 0.5f, 0f, 0f); tools_align.Child = toolbar; var search_align = new Alignment(0.5f, 0.5f, 0f, 0f); search_align.Child = _view_container.SearchEntry; var lbox = new HBox(); lbox.PackStart(task_status, false, false, 0); lbox.PackStart(tools_align, true, true, 0); var rbox = new HBox(); rbox.PackEnd(search_align, true, true, 0); grid.Attach(lbox, 0, 0, 1, 1); grid.Attach(seek_slider, 1, 0, 1, 1); grid.Attach(rbox, 2, 0, 1, 1); _ready.Add(() => { task_status.Show(); next_button.Show(); repeat_button.Show(); tools_align.Show(); search_align.Show(); lbox.Show(); seek_slider.Show(); rbox.Show(); }); return(grid); }
void ReleaseDesignerOutlets() { if (BufferedProgressSlider != null) { BufferedProgressSlider.Dispose(); BufferedProgressSlider = null; } if (NextButton != null) { NextButton.Dispose(); NextButton = null; } if (PlayingProgressSlider != null) { PlayingProgressSlider.Dispose(); PlayingProgressSlider = null; } if (PlayPauseButton != null) { PlayPauseButton.Dispose(); PlayPauseButton = null; } if (PreviousButton != null) { PreviousButton.Dispose(); PreviousButton = null; } if (QueueLabel != null) { QueueLabel.Dispose(); QueueLabel = null; } if (RepeatButton != null) { RepeatButton.Dispose(); RepeatButton = null; } if (ShuffleButton != null) { ShuffleButton.Dispose(); ShuffleButton = null; } if (SubtitleLabel != null) { SubtitleLabel.Dispose(); SubtitleLabel = null; } if (TimePlayedLabel != null) { TimePlayedLabel.Dispose(); TimePlayedLabel = null; } if (TimeTotalLabel != null) { TimeTotalLabel.Dispose(); TimeTotalLabel = null; } if (TitleLabel != null) { TitleLabel.Dispose(); TitleLabel = null; } if (TrackCoverImageView != null) { TrackCoverImageView.Dispose(); TrackCoverImageView = null; } }
public void DefaultMethods () { RepeatButton rb = new RepeatButton (); rb.OnApplyTemplate (); ControlTest.CheckDefaultMethods (rb); }
public static IObservable <EventPattern <ManipulationCompletedEventArgs> > ManipulationCompletedObserver(this RepeatButton This) { return(Observable.FromEventPattern <EventHandler <ManipulationCompletedEventArgs>, ManipulationCompletedEventArgs>(h => This.ManipulationCompleted += h, h => This.ManipulationCompleted -= h)); }
public static IObservable <EventPattern <RoutedEventArgs> > LostFocusObserver(this RepeatButton This) { return(Observable.FromEventPattern <RoutedEventHandler, RoutedEventArgs>(h => This.LostFocus += h, h => This.LostFocus -= h)); }
public static IObservable <EventPattern <MouseButtonEventArgs> > PreviewMouseUpObserver(this RepeatButton This) { return(Observable.FromEventPattern <MouseButtonEventHandler, MouseButtonEventArgs>(h => This.PreviewMouseUp += h, h => This.PreviewMouseUp -= h)); }
private void ScrollBar_PreviewMouseDown(object sender, MouseButtonEventArgs e) { Visual source = e.OriginalSource as Visual; if (source.FindVisualParents <Thumb>(false).Count() > 0) { if (isHold = Mouse.Capture(ScrollBar as IInputElement)) { e.Handled = true; // Scroll Factor lastScroll = ScrollAction.Mouse; beginValue = ScrollBar.Value; beginPosition = Mouse.GetPosition(ScrollBar); } } else { RepeatButtonHolder holder = null; RepeatButton repeatButton = source .FindVisualParents <RepeatButton>(false) .FirstOrDefault(); var pos = Mouse.GetPosition(ScrollBar.Track); if (repeatButton == ScrollBar.Track.IncreaseRepeatButton || // Down Track repeatButton == ScrollBar.Track.DecreaseRepeatButton) // Up Track { e.Handled = true; double targetOffset = pos.Y * GetScrollRatio(); double thumbOffset = ScrollBar.Track.Thumb.ActualHeight * GetScrollRatio(); if (targetOffset > virtualOffset) { targetOffset -= thumbOffset; } targetOffset = OffsetLimit(targetOffset); holder = new RepeatButtonHolder(repeatButton); holder.OnClick += delegate { // Scroll Factor isBounding = false; acceleration = 0.15; lastScroll = ScrollAction.Track; // Target Offset double delta = targetOffset - toOffset; int sDelta = Math.Sign(delta); double offset = toOffset + thumbOffset * sDelta; if (Math.Abs(targetOffset - offset) < thumbOffset) { toOffset = targetOffset; } else { toOffset = offset; } }; } else { // Small RepeatButton e.Handled = true; if (pos.Y < ScrollBar.Track.ActualHeight / 2) // Up Button { holder = new RepeatButtonHolder(repeatButton); holder.OnClick += delegate { // Scroll Factor isBounding = false; acceleration = 0.15; lastScroll = ScrollAction.Track; toOffset -= StepSize / 3; toOffset = OffsetLimit(toOffset); }; } else // Down Button { holder = new RepeatButtonHolder(repeatButton); holder.OnClick += delegate { // Scroll Factor isBounding = false; acceleration = 0.15; lastScroll = ScrollAction.Track; toOffset += StepSize / 3; toOffset = OffsetLimit(toOffset); }; } } if (holder != null) { holder.Start(); repeatHolders.Add(holder); } } }
public static IObservable <EventPattern <ContextMenuEventArgs> > ContextMenuClosingObserver(this RepeatButton This) { return(Observable.FromEventPattern <ContextMenuEventHandler, ContextMenuEventArgs>(h => This.ContextMenuClosing += h, h => This.ContextMenuClosing -= h)); }
/// <summary> /// Applies the orientation templates. /// </summary> private void ApplyOrientationTemplate() { horizontalRoot = this.GetTemplateChild("HorizontalRoot") as Grid; verticalRoot = this.GetTemplateChild("VerticalRoot") as Grid; if (LargeIncrease != null) { LargeIncrease.Click -= OnLargeIncreaseClick; } if (LargeDecrease != null) { LargeDecrease.Click -= OnLargeDecreaseClick; } if (SmallDecrease != null) { SmallDecrease.Click -= OnSmallDecreaseClick; } if (SmallIncrease != null) { SmallIncrease.Click -= OnSmallIncreaseClick; } if (NearHand != null) { NearHand.DragDelta -= OnNearHandDragged; } if (FarHand != null) { FarHand.DragDelta -= OnFarHandDragged; } if (MiddleThumb != null) { MiddleThumb.DragDelta -= OnThumbDragged; } if (this.Orientation == Orientation.Horizontal && horizontalRoot != null) { horizontalRoot.Visibility = Visibility.Visible; verticalRoot.Visibility = Visibility.Collapsed; NearHand = this.GetTemplateChild("HorizontalThumbHand1") as Thumb; FarHand = this.GetTemplateChild("HorizontalThumbHand2") as Thumb; MiddleThumb = this.GetTemplateChild("HorizontalThumb") as Thumb; SmallDecrease = this.GetTemplateChild("HorizontalSmallDecrease") as RepeatButton; LargeDecrease = this.GetTemplateChild("HorizontalLargeDecrease") as RepeatButton; LargeIncrease = this.GetTemplateChild("HorizontalLargeIncrease") as RepeatButton; SmallIncrease = this.GetTemplateChild("HorizontalSmallIncrease") as RepeatButton; NearHand.DragDelta += OnNearHandDragged; FarHand.DragDelta += OnFarHandDragged; MiddleThumb.DragDelta += OnThumbDragged; LargeIncrease.Click += OnLargeIncreaseClick; LargeDecrease.Click += OnLargeDecreaseClick; SmallDecrease.Click += OnSmallDecreaseClick; SmallIncrease.Click += OnSmallIncreaseClick; } else if (verticalRoot != null) { horizontalRoot.Visibility = Visibility.Collapsed; verticalRoot.Visibility = Visibility.Visible; NearHand = this.GetTemplateChild("VerticalThumbHand1") as Thumb; FarHand = this.GetTemplateChild("VerticalThumbHand2") as Thumb; MiddleThumb = this.GetTemplateChild("VerticalThumb") as Thumb; SmallDecrease = this.GetTemplateChild("VerticalSmallDecrease") as RepeatButton; LargeDecrease = this.GetTemplateChild("VerticalLargeDecrease") as RepeatButton; LargeIncrease = this.GetTemplateChild("VerticalLargeIncrease") as RepeatButton; SmallIncrease = this.GetTemplateChild("VerticalSmallIncrease") as RepeatButton; NearHand.DragDelta += OnNearHandDragged; FarHand.DragDelta += OnFarHandDragged; MiddleThumb.DragDelta += OnThumbDragged; LargeIncrease.Click += OnLargeIncreaseClick; LargeDecrease.Click += OnLargeDecreaseClick; SmallDecrease.Click += OnSmallDecreaseClick; SmallIncrease.Click += OnSmallIncreaseClick; } IsValueChangedTrigger = true; }
/// <summary> /// Invoked whenever application code or internal processes (such as a rebuilding layout pass) call ApplyTemplate. In simplest terms, this means the method is called just before a UI element displays in your app. Override this method to influence the default post-template logic of a class. /// </summary> protected override void OnApplyTemplate() { base.OnApplyTemplate(); if (DesignMode.DesignModeEnabled) { return; } this.GotFocus += OnGotFocus; this.LostFocus += OnLostFocus; this.PointerWheelChanged += OnPointerWheelChanged; _valueTextBox = GetTemplateChild(ValueTextBoxName) as TextBox; _dragOverlay = GetTemplateChild(DragOverlayName) as UIElement; _decrementButton = GetTemplateChild(DecrementButtonName) as RepeatButton; _incrementButton = GetTemplateChild(IncrementButtonName) as RepeatButton; _valueBar = GetTemplateChild(ValueBarName) as FrameworkElement; if (_valueTextBox != null) { _valueTextBox.LostFocus += OnValueTextBoxLostFocus; _valueTextBox.GotFocus += OnValueTextBoxGotFocus; _valueTextBox.Text = Value.ToString(); _valueTextBox.TextChanged += OnValueTextBoxTextChanged; } if (_dragOverlay != null) { _dragOverlay.Tapped += OnDragOverlayTapped; _dragOverlay.ManipulationMode = ManipulationModes.TranslateX | ManipulationModes.TranslateY; _dragOverlay.PointerPressed += OnDragOverlayPointerPressed; Window.Current.CoreWindow.PointerReleased += CoreWindowOnPointerReleased; Window.Current.CoreWindow.VisibilityChanged += OnCoreWindowVisibilityChanged; _dragOverlay.PointerReleased += OnDragOverlayPointerReleased; _dragOverlay.PointerCaptureLost += OnDragOverlayPointerCaptureLost; } if (_decrementButton != null) { _decrementButton.Click += OnDecrementButtonClick; var pcc = new PropertyChangeEventSource <bool> (_decrementButton, "IsPressed"); pcc.ValueChanged += OnDecrementButtonIsPressedChanged; } if (_incrementButton != null) { _incrementButton.Click += OnIncrementButtonClick; var pcc = new PropertyChangeEventSource <bool> (_incrementButton, "IsPressed"); pcc.ValueChanged += OnIncrementButtonIsPressedChanged; } if (_valueBar != null) { _valueBar.SizeChanged += OnValueBarSizeChanged; UpdateValueBar(); } UpdateIsReadOnlyDependants(); SetValidIncrementDirection(); }
public static IObservable <EventPattern <SizeChangedEventArgs> > SizeChangedObserver(this RepeatButton This) { return(Observable.FromEventPattern <SizeChangedEventHandler, SizeChangedEventArgs>(h => This.SizeChanged += h, h => This.SizeChanged -= h)); }
public static IObservable <EventPattern <ToolTipEventArgs> > ToolTipClosingObserver(this RepeatButton This) { return(Observable.FromEventPattern <ToolTipEventHandler, ToolTipEventArgs>(h => This.ToolTipClosing += h, h => This.ToolTipClosing -= h)); }
void Bind(RepeatButton repeatButton) { Utility.SetBinding(repeatButton, RepeatButton.DelayProperty, this, "Delay"); Utility.SetBinding(repeatButton, RepeatButton.IntervalProperty, this, "Interval"); }
private bool AttachClickEventToRepeatButton(RepeatButton button, Action action) { if (button == null) return false; button.Click += (RoutedEventHandler)((s, e) => action()); return true; }
/// <summary>${controls_Compass_method_onApplyTemplate_D}</summary> public override void OnApplyTemplate() { base.OnApplyTemplate(); this.rotateRingElement = base.GetTemplateChild("RotateRingElement") as FrameworkElement; this.transformRotateElement = base.GetTemplateChild("TransformRotateElement") as RotateTransform; this.panLeftElement = base.GetTemplateChild("PanLeftElement") as RepeatButton; this.panRightElement = base.GetTemplateChild("PanRightElement") as RepeatButton; this.panUpElement = base.GetTemplateChild("PanUpElement") as RepeatButton; this.panDownElement = base.GetTemplateChild("PanDownElement") as RepeatButton; this.viewEntireElement = base.GetTemplateChild("ViewEntireElement") as Button; #region 上下左右 if (this.panLeftElement != null) { this.panLeftElement.Click += (sender, args) => { if ((this.Map != null) && (sender != null)) { this.Map.Pan(-this.Map.ViewBounds.Width * this.Map.PanFactor, 0); } }; } if (this.panRightElement != null) { this.panRightElement.Click += (sender, args) => { if ((this.Map != null) && (sender != null)) { this.Map.Pan(this.Map.ViewBounds.Width * this.Map.PanFactor, 0); } }; } if (this.panDownElement != null) { this.panDownElement.Click += (sender, args) => { if ((this.Map != null) && (sender != null)) { this.Map.Pan(0, -this.Map.ViewBounds.Height * this.Map.PanFactor); } }; } if (this.panUpElement != null) { this.panUpElement.Click += (sender, args) => { if ((this.Map != null) && (sender != null)) { this.Map.Pan(0, this.Map.ViewBounds.Height * this.Map.PanFactor); } }; } #endregion if (this.rotateRingElement != null && this.transformRotateElement != null) { this.rotateRingElement.MouseLeftButtonDown += new MouseButtonEventHandler(RotateRing_MouseLeftButtonDown); this.rotateRingElement.MouseMove += new MouseEventHandler(RotateRing_MouseMove); this.rotateRingElement.MouseLeftButtonUp += new MouseButtonEventHandler(RotateRing_MouseLeftButtonUp); } if (this.viewEntireElement != null) { this.viewEntireElement.Click += new RoutedEventHandler(this.ZoomViewEntire_Click); } ChangeAngle(); }
public void Creation () { RepeatButton repeat_button = new RepeatButton (); Assert.AreEqual (repeat_button.ActualWidth, 0, "repeat_button.ActualWidth"); Assert.AreEqual (repeat_button.ActualHeight, 0, "repeat_button.ActualHeight"); }
/// <summary> /// When overridden in a derived class, is invoked whenever application code or internal processes call <see /// cref="M:System.Windows.FrameworkElement.ApplyTemplate" />. /// </summary> public override void OnApplyTemplate() { base.OnApplyTemplate(); this.upbutton = this.GetTemplateChild(PartUp) as RepeatButton; this.downbutton = this.GetTemplateChild(PartDown) as RepeatButton; if (this.upbutton != null) { this.upbutton.Click += this.UpbuttonClick; } if (this.downbutton != null) { this.downbutton.Click += this.DownbuttonClick; } }
/* * Protected override methods * */ #region Overrides /// <summary> /// OnApplyTemplate override /// </summary> public override void OnApplyTemplate() { base.OnApplyTemplate(); // set up the event handler for the template parts _toggleButton = this.Template.FindName("PART_DropDown", this) as ToggleButton; if (_toggleButton != null) { // create a context menu for the togglebutton ContextMenu cm = new ContextMenu { PlacementTarget = _toggleButton, Placement = PlacementMode.Bottom }; // create a binding between the togglebutton's IsChecked Property // and the Context Menu's IsOpen Property Binding b = new Binding { Source = _toggleButton, Mode = BindingMode.TwoWay, Path = new PropertyPath(ToggleButton.IsCheckedProperty) }; cm.SetBinding(ContextMenu.IsOpenProperty, b); _toggleButton.ContextMenu = cm; _toggleButton.Checked += DropdownButton_Checked; } ScrollViewer scrollViewer = this.Template.FindName("PART_ScrollViewer", this) as ScrollViewer; // set up event handlers for the RepeatButtons Click event RepeatButton repeatLeft = this.Template.FindName("PART_RepeatLeft", this) as RepeatButton; if (repeatLeft != null) { repeatLeft.Click += delegate { if (scrollViewer != null) { scrollViewer.LineLeft(); } }; } RepeatButton repeatRight = this.Template.FindName("PART_RepeatRight", this) as RepeatButton; if (repeatRight != null) { repeatRight.Click += delegate { if (scrollViewer != null) { scrollViewer.LineRight(); } }; } // set up the event handler for the 'New Tab' Button Click event _addNewButton = this.Template.FindName("PART_NewTabButton", this) as ButtonBase; if (_addNewButton != null) { _addNewButton.Click += ((sender, routedEventArgs) => AddTabItem()); } }
public override void OnApplyTemplate() { base.OnApplyTemplate(); if (_lowerRange != null) { _lowerRange.Click -= new RoutedEventHandler(this.LowerRange_Click); } _lowerRange = this.Template.FindName(PART_LowerRange, this) as RepeatButton; if (_lowerRange != null) { _lowerRange.Click += new RoutedEventHandler(this.LowerRange_Click); } if (_higherRange != null) { _higherRange.Click -= new RoutedEventHandler(this.HigherRange_Click); } _higherRange = this.Template.FindName(PART_HigherRange, this) as RepeatButton; if (_higherRange != null) { _higherRange.Click += new RoutedEventHandler(this.HigherRange_Click); } if (_lowerSlider != null) { _lowerSlider.Loaded -= this.Slider_Loaded; _lowerSlider.ValueChanged -= LowerSlider_ValueChanged; if (_lowerTrack != null) { _lowerTrack.Thumb.DragCompleted -= this.LowerSlider_DragCompleted; } } _lowerSlider = this.Template.FindName(PART_LowerSlider, this) as Slider; if (_lowerSlider != null) { _lowerSlider.Loaded += this.Slider_Loaded; _lowerSlider.ValueChanged += LowerSlider_ValueChanged; _lowerSlider.ApplyTemplate(); _lowerTrack = _lowerSlider.Template.FindName(PART_Track, _lowerSlider) as Track; if (_lowerTrack != null) { _lowerTrack.Thumb.DragCompleted += this.LowerSlider_DragCompleted; } } if (_higherSlider != null) { _higherSlider.Loaded -= this.Slider_Loaded; _higherSlider.ValueChanged -= HigherSlider_ValueChanged; if (_higherTrack != null) { _higherTrack.Thumb.DragCompleted -= this.HigherSlider_DragCompleted; } } _higherSlider = this.Template.FindName(PART_HigherSlider, this) as Slider; if (_higherSlider != null) { _higherSlider.Loaded += this.Slider_Loaded; _higherSlider.ValueChanged += HigherSlider_ValueChanged; _higherSlider.ApplyTemplate(); _higherTrack = _higherSlider.Template.FindName(PART_Track, _higherSlider) as Track; if (_higherTrack != null) { _higherTrack.Thumb.DragCompleted += this.HigherSlider_DragCompleted; } } }
public static IObservable <EventPattern <RoutedEventArgs> > UnloadedObserver(this RepeatButton This) { return(Observable.FromEventPattern <RoutedEventHandler, RoutedEventArgs>(h => This.Unloaded += h, h => This.Unloaded -= h)); }
protected override void OnApplyTemplate() #endif { base.OnApplyTemplate(); #if UWP if (DesignMode.DesignModeEnabled) { return; } #endif this.GotFocus += this.OnGotFocus; this.LostFocus += this.OnLostFocus; #if UWP this.PointerWheelChanged += this.OnPointerWheelChanged; #endif _valueTextBox = this.GetTemplateChild(ValueTextBoxName) as UpDownTextBox; _dragOverlay = this.GetTemplateChild(DragOverlayName) as UIElement; _decrementButton = this.GetTemplateChild(DecrementButtonName) as RepeatButton; _incrementButton = this.GetTemplateChild(IncrementButtonName) as RepeatButton; _valueBar = this.GetTemplateChild(ValueBarName) as FrameworkElement; if (_valueTextBox != null) { _valueTextBox.LostFocus += this.OnValueTextBoxLostFocus; _valueTextBox.GotFocus += this.OnValueTextBoxGotFocus; #if UWP _valueTextBox.Text = this.Value.ToString(CultureInfo.CurrentCulture); #else _valueTextBox.Text = this.Value.ToString(); #endif _valueTextBox.TextChanged += this.OnValueTextBoxTextChanged; _valueTextBox.KeyDown += this.OnValueTextBoxKeyDown; _valueTextBox.UpPressed += (s, e) => this.DoIncrement(); _valueTextBox.DownPressed += (s, e) => this.DoDecrement(); #if UWP _valueTextBox.PointerExited += this.OnValueTextBoxPointerExited; #endif } if (_dragOverlay != null) { #if UWP _dragOverlay.Tapped += this.OnDragOverlayTapped; _dragOverlay.ManipulationMode = ManipulationModes.TranslateX | ManipulationModes.TranslateY; #endif #if MIGRATION _dragOverlay.MouseLeftButtonDown += this.OnDragOverlayPointerPressed; _dragOverlay.MouseLeftButtonUp += this.OnDragOverlayPointerReleased; _dragOverlay.LostMouseCapture += this.OnDragOverlayPointerCaptureLost; #else _dragOverlay.PointerPressed += this.OnDragOverlayPointerPressed; _dragOverlay.PointerReleased += this.OnDragOverlayPointerReleased; _dragOverlay.PointerCaptureLost += this.OnDragOverlayPointerCaptureLost; #endif } if (_decrementButton != null) { _decrementButton.Click += this.OnDecrementButtonClick; #if UWP var pcc = new PropertyChangeEventSource <bool> (_decrementButton, "IsPressed"); pcc.ValueChanged += this.OnDecrementButtonIsPressedChanged; #endif } if (_incrementButton != null) { _incrementButton.Click += this.OnIncrementButtonClick; #if UWP var pcc = new PropertyChangeEventSource <bool> (_incrementButton, "IsPressed"); pcc.ValueChanged += this.OnIncrementButtonIsPressedChanged; #endif } if (_valueBar != null) { _valueBar.SizeChanged += this.OnValueBarSizeChanged; this.UpdateValueBar(); } this.UpdateIsReadOnlyDependants(); this.SetValidIncrementDirection(); }
public override void OnApplyTemplate() { base.OnApplyTemplate(); //Internal controls. _upButton = Template.FindName("UpButton", this) as RepeatButton; _downButton = Template.FindName("DownButton", this) as RepeatButton; _textBox = Template.FindName("InternalBox", this) as TextBox; if (_upButton != null) _upButton.Click += UpButton_Click; if (_downButton != null) _downButton.Click += DownButton_Click; if (_textBox != null) { _textBox.PreviewKeyDown += TextBox_PreviewKeyDown; _textBox.PreviewTextInput += TextBox_PreviewTextInput; _textBox.MouseWheel += TextBox_MouseWheel; _textBox.LostFocus += TextBox_LostFocus; _textBox.TextChanged += TextBox_TextChanged; } Value = Value == 0d ? Minimum : Value; AddHandler(DataObject.PastingEvent, new DataObjectPastingEventHandler(PastingEvent)); InternalValueChanged += (sender, args) => { CheckValue(); }; InternalMaximumChanged += (sender, args) => { CheckMaximum(); }; InternalMinimumChanged += (sender, args) => { CheckMinimum(); }; }
public static IObservable <EventPattern <ManipulationBoundaryFeedbackEventArgs> > ManipulationBoundaryFeedbackObserver(this RepeatButton This) { return(Observable.FromEventPattern <EventHandler <ManipulationBoundaryFeedbackEventArgs>, ManipulationBoundaryFeedbackEventArgs>(h => This.ManipulationBoundaryFeedback += h, h => This.ManipulationBoundaryFeedback -= h)); }
/// <summary> /// Overrides the default OnApplyTemplate to configure child FrameworkElement references from the applied template /// </summary> public override void OnApplyTemplate() { base.OnApplyTemplate(); spin = (Button)GetTemplateChild("spin"); up = (Button)GetTemplateChild("up"); down = (Button)GetTemplateChild("down"); left = (Button)GetTemplateChild("left"); right = (Button)GetTemplateChild("right"); zoomIn = (RepeatButton)GetTemplateChild("zoomIn"); zoomOut = (RepeatButton)GetTemplateChild("zoomOut"); _ExpandNavigation = (VisualState)GetTemplateChild("Expanded"); _CollapseNavigation = (VisualState)GetTemplateChild("Collapsed"); _ToolbarBorder = (Border)GetTemplateChild("borderNavigation"); _ContentControl = (ContentControl)GetTemplateChild("toolbarContent"); if(_ToolbarContent != null) Toolbar = _ToolbarContent; rotationGlobeGrid = (Grid)GetTemplateChild("rotationGlobeGrid"); rotationGlobeGridAngle = (RotateTransform)GetTemplateChild("rotationGlobeGridAngle"); //Create the animations for Expand/Collapse of the upper toolbar _AnimationCollapseToolbar = AnimationCollapseToolbar; _AnimationExpandToolbar = AnimationExpandToolbar; spin.Click += spin_Click; zoomIn.Click += zoomIn_Click; zoomOut.Click += zoomOut_Click; up.Click += up_Click; down.Click += down_Click; left.Click += left_Click; right.Click += right_Click; rotationGlobeGrid.MouseLeftButtonDown += rotationGlobeGrid_MouseLeftButtonDown; rotationGlobeGrid.MouseLeftButtonUp += rotationGlobeGrid_MouseLeftButtonUp; rotationGlobeGrid.MouseMove += rotationGlobeGrid_MouseMove; if(HtmlPage.IsEnabled) { MapInstance.Events.MapRotationChanged += Events_MapRotationChanged; } }
public static IObservable <EventPattern <MouseButtonEventArgs> > MouseDownObserver(this RepeatButton This) { return(Observable.FromEventPattern <MouseButtonEventHandler, MouseButtonEventArgs>(h => This.MouseDown += h, h => This.MouseDown -= h)); }
/// public RepeatButtonAutomationPeer(RepeatButton owner): base(owner) {}
/// <summary>${controls_NavControl_method_onApplyTemplate_D}</summary> public override void OnApplyTemplate( ) { base.OnApplyTemplate(); rotateRingElement = GetTemplateChild("RotateRingElement") as FrameworkElement; transformRotateElement = GetTemplateChild("TransformRotateElement") as RotateTransform; panLeftElement = GetTemplateChild("PanLeftElement") as RepeatButton; panRightElement = GetTemplateChild("PanRightElement") as RepeatButton; panUpElement = GetTemplateChild("PanUpElement") as RepeatButton; panDownElement = GetTemplateChild("PanDownElement") as RepeatButton; viewEntireElement = GetTemplateChild("ViewEntireElement") as Button; zoomSliderElement = GetTemplateChild("ZoomSlider") as Slider; zoomInElement = GetTemplateChild("ZoomInElement") as RepeatButton; zoomOutElement = GetTemplateChild("ZoomOutElement") as RepeatButton; #region 上下左右 if (this.panLeftElement != null) { this.panLeftElement.Click += (sender , args) => { if (( this.Map != null ) && ( sender != null )) { this.Map.Pan(-this.Map.ViewBounds.Width * Map.PanFactor , 0); } }; } if (this.panRightElement != null) { this.panRightElement.Click += (sender , args) => { if (( this.Map != null ) && ( sender != null )) { this.Map.Pan(this.Map.ViewBounds.Width * this.Map.PanFactor , 0); } }; } if (this.panDownElement != null) { this.panDownElement.Click += (sender , args) => { if (( this.Map != null ) && ( sender != null )) { this.Map.Pan(0 , -this.Map.ViewBounds.Height * this.Map.PanFactor); } }; } if (this.panUpElement != null) { this.panUpElement.Click += (sender , args) => { if (( this.Map != null ) && ( sender != null )) { this.Map.Pan(0 , this.Map.ViewBounds.Height * this.Map.PanFactor); } }; } #endregion SetupZoom(); if (zoomSliderElement != null) { zoomSliderElement.MouseEnter += new MouseEventHandler(zoomSliderElement_MouseEnter); zoomSliderElement.MouseLeave += new MouseEventHandler(zoomSliderElement_MouseLeave); zoomSliderElement.ValueChanged += new RoutedPropertyChangedEventHandler<double>(this.ZoomSlider_ValueChanged); } if (zoomInElement != null) { zoomInElement.Click += new RoutedEventHandler(this.ZoomInButton_Click); } if (zoomOutElement != null) { zoomOutElement.Click += new RoutedEventHandler(this.ZoomOutButton_Click); } if (rotateRingElement != null && this.transformRotateElement != null) { rotateRingElement.MouseLeftButtonDown += _rotateRingMouseLeftBtnDown; rotateRingElement.MouseMove += _rotateRingMouseMove; rotateRingElement.MouseLeftButtonUp += _rotateRingMouseLeftBtnUp; } if (viewEntireElement != null) { viewEntireElement.Click += new RoutedEventHandler(this.ZoomViewEntire_Click); } }
/// <summary> /// When overridden in a derived class, is invoked whenever application code or internal processes call /// <see cref="M:System.Windows.FrameworkElement.ApplyTemplate" />. /// </summary> public override void OnApplyTemplate() { base.OnApplyTemplate(); _repeatUp = GetTemplateChild(ElementNumericUp) as RepeatButton; _repeatDown = GetTemplateChild(ElementNumericDown) as RepeatButton; _valueTextBox = GetTemplateChild(ElementTextBox) as TextBox; if (_repeatUp == null || _repeatDown == null || _valueTextBox == null) { throw new InvalidOperationException(string.Format("You have missed to specify {0}, {1} or {2} in your template", ElementNumericUp, ElementNumericDown, ElementTextBox)); } _valueTextBox.LostFocus += OnTextBoxLostFocus; _valueTextBox.PreviewTextInput += OnPreviewTextInput; _valueTextBox.IsReadOnly = IsReadOnly; _valueTextBox.PreviewKeyDown += OnTextBoxKeyDown; _valueTextBox.TextChanged += OnTextChanged; DataObject.AddPastingHandler(_valueTextBox, OnValueTextBoxPaste); _repeatUp.Click += (o, e) => ChangeValueWithSpeedUp(true); _repeatDown.Click += (o, e) => ChangeValueWithSpeedUp(false); _repeatUp.PreviewMouseUp += (o, e) => ResetInternal(); _repeatDown.PreviewMouseUp += (o, e) => ResetInternal(); OnValueChanged(Value, Value); }
public TrackballDecorator() { // the transform that will be applied to the viewport 3d's camera transform = new Transform3DGroup(); transform.Children.Add(scale); transform.Children.Add(new RotateTransform3D(rotation)); // used so that we always get events while activity occurs within // the viewport3D eventSource = new Border(); eventSource.Background = Brushes.Transparent; PreViewportChildren.Add(eventSource); Canvas canvas = new Canvas(); RepeatButton zoomInButton = new RepeatButton { Content = "+", VerticalContentAlignment = VerticalAlignment.Center, HorizontalContentAlignment = HorizontalAlignment.Center, Width = 30, Height = 30, Background = Brushes.Transparent }; Canvas.SetRight(zoomInButton, 10); Canvas.SetTop(zoomInButton, 10); canvas.Children.Add(zoomInButton); zoomInButton.Click += ZoomInButton_Click; RepeatButton zoomOutButton = new RepeatButton { Content = "-", VerticalContentAlignment = VerticalAlignment.Center, HorizontalContentAlignment = HorizontalAlignment.Center, Width = 30, Height = 30, Background = Brushes.Transparent }; Canvas.SetRight(zoomOutButton, 10); Canvas.SetTop(zoomOutButton, 50); canvas.Children.Add(zoomOutButton); zoomOutButton.Click += ZoomOutButton_Click; Button xPlus = CreateNavigationButton("+X", 10, 10); xPlus.Click += new RoutedEventHandler(xPlus_Click); canvas.Children.Add(xPlus); Button xMinus = CreateNavigationButton("-X", 40, 10); xMinus.Click += new RoutedEventHandler(xMinus_Click); canvas.Children.Add(xMinus); Button yPlus = CreateNavigationButton("+Y", 10, 40); yPlus.Click += new RoutedEventHandler(yPlus_Click); canvas.Children.Add(yPlus); Button yMinus = CreateNavigationButton("-Y", 40, 40); yMinus.Click += new RoutedEventHandler(yMinus_Click); canvas.Children.Add(yMinus); Button zPlus = CreateNavigationButton("+Z", 10, 70); zPlus.Click += new RoutedEventHandler(zPlus_Click); canvas.Children.Add(zPlus); Button zMinus = CreateNavigationButton("-Z", 40, 70); zMinus.Click += new RoutedEventHandler(zMinus_Click); canvas.Children.Add(zMinus); PreViewportChildren.Add(canvas); }
/// <inheritdoc/> public override void OnApplyTemplate() { base.OnApplyTemplate(); increaseButton = GetTemplateChild("PART_IncreaseButton") as RepeatButton; if (increaseButton == null) throw new InvalidOperationException("A part named 'PART_IncreaseButton' must be present in the ControlTemplate, and must be of type 'RepeatButton'."); decreaseButton = GetTemplateChild("PART_DecreaseButton") as RepeatButton; if (decreaseButton == null) throw new InvalidOperationException("A part named 'PART_DecreaseButton' must be present in the ControlTemplate, and must be of type 'RepeatButton'."); contentHost = GetTemplateChild("PART_ContentHost") as ScrollViewer; if (contentHost == null) throw new InvalidOperationException("A part named 'PART_ContentHost' must be present in the ControlTemplate, and must be of type 'ScrollViewer'."); var increasePressedWatcher = new DependencyPropertyWatcher(increaseButton); increasePressedWatcher.RegisterValueChangedHandler(ButtonBase.IsPressedProperty, RepeatButtonIsPressedChanged); var decreasePressedWatcher = new DependencyPropertyWatcher(decreaseButton); decreasePressedWatcher.RegisterValueChangedHandler(ButtonBase.IsPressedProperty, RepeatButtonIsPressedChanged); var textValue = FormatValue(Value); SetCurrentValue(TextProperty, textValue); contentHost.QueryCursor += HostQueryCursor; }
public static IObservable <EventPattern <ManipulationInertiaStartingEventArgs> > ManipulationInertiaStartingObserver(this RepeatButton This) { return(Observable.FromEventPattern <EventHandler <ManipulationInertiaStartingEventArgs>, ManipulationInertiaStartingEventArgs>(h => This.ManipulationInertiaStarting += h, h => This.ManipulationInertiaStarting -= h)); }
public override void OnApplyTemplate() #endif { base.OnApplyTemplate(); SliderTrack = GetTemplateChild(nameof(SliderTrack)) as FrameworkElement; if (SliderTrack != null) { SliderTrack.SizeChanged += TimeSlider_SizeChanged; } HorizontalTrackThumb = GetTemplateChild(nameof(HorizontalTrackThumb)) as Thumb; MinimumThumb = GetTemplateChild(nameof(MinimumThumb)) as Thumb; MinimumThumbLabel = GetTemplateChild(nameof(MinimumThumbLabel)) as TextBlock; MaximumThumb = GetTemplateChild(nameof(MaximumThumb)) as Thumb; MaximumThumbLabel = GetTemplateChild(nameof(MaximumThumbLabel)) as TextBlock; SliderTrackStepBackRepeater = GetTemplateChild(nameof(SliderTrackStepBackRepeater)) as RepeatButton; SliderTrackStepForwardRepeater = GetTemplateChild(nameof(SliderTrackStepForwardRepeater)) as RepeatButton; PlayPauseButton = GetTemplateChild(nameof(PlayPauseButton)) as ToggleButton; NextButton = GetTemplateChild(nameof(NextButton)) as ButtonBase; PreviousButton = GetTemplateChild(nameof(PreviousButton)) as ButtonBase; Tickmarks = GetTemplateChild(nameof(Tickmarks)) as Primitives.Tickbar; FullExtentStartTimeLabel = GetTemplateChild(nameof(FullExtentStartTimeLabel)) as TextBlock; FullExtentEndTimeLabel = GetTemplateChild(nameof(FullExtentEndTimeLabel)) as TextBlock; if (MinimumThumb != null) { #if NETFX_CORE MinimumThumb.ManipulationMode = ManipulationModes.TranslateX; MinimumThumb.ManipulationDelta += (s, e) => { // Position is reported relative to the left edge of the thumb. Adjust it so it is relative to the thumb's center. var translateX = e.Position.X - (MinimumThumb.ActualWidth / 2); OnMinimumThumbDrag(translateX); }; #else MinimumThumb.DragDelta += (s, e) => OnMinimumThumbDrag(e.HorizontalChange); #endif MinimumThumb.DragCompleted += (s, e) => OnDragCompleted(); MinimumThumb.DragStarted += (s, e) => SetFocus(); } if (MaximumThumb != null) { #if NETFX_CORE MaximumThumb.ManipulationMode = ManipulationModes.TranslateX; MaximumThumb.ManipulationDelta += (s, e) => { // Position is reported relative to the left edge of the thumb. Adjust it so it is relative to the thumb's center. var translateX = e.Position.X - (MaximumThumb.ActualWidth / 2); OnMaximumThumbDrag(translateX); }; #else MaximumThumb.DragDelta += (s, e) => OnMaximumThumbDrag(e.HorizontalChange); #endif MaximumThumb.DragCompleted += (s, e) => OnDragCompleted(); MaximumThumb.DragStarted += (s, e) => SetFocus(); } if (HorizontalTrackThumb != null) { #if NETFX_CORE HorizontalTrackThumb.ManipulationMode = ManipulationModes.TranslateX; HorizontalTrackThumb.ManipulationDelta += (s, e) => { // Position is reported relative to the left edge of the thumb. Adjust it so it is relative to the thumb's center. var translateX = e.Position.X - (HorizontalTrackThumb.ActualWidth / 2); OnCurrentExtentThumbDrag(translateX); }; #else HorizontalTrackThumb.DragDelta += (s, e) => OnCurrentExtentThumbDrag(e.HorizontalChange); #endif HorizontalTrackThumb.DragCompleted += (s, e) => OnDragCompleted(); HorizontalTrackThumb.DragStarted += (s, e) => SetFocus(); } if (SliderTrackStepBackRepeater != null) { SliderTrackStepBackRepeater.Click += (s, e) => { SetFocus(); IsPlaying = false; StepBack(); }; } if (SliderTrackStepForwardRepeater != null) { SliderTrackStepForwardRepeater.Click += (s, e) => { SetFocus(); IsPlaying = false; StepForward(); }; } if (PlayPauseButton != null) { IsPlaying = PlayPauseButton.IsChecked.Value; PlayPauseButton.Checked += (s, e) => IsPlaying = true; PlayPauseButton.Unchecked += (s, e) => IsPlaying = false; } if (NextButton != null) { NextButton.Click += (s, e) => OnNextButtonClick(); } if (PreviousButton != null) { PreviousButton.Click += (s, e) => OnPreviousButtonClick(); } PositionTickmarks(); SetButtonVisibility(); ApplyLabelMode(LabelMode); }
public override void OnApplyTemplate() { base.OnApplyTemplate(); this.RotateRing = base.GetTemplateChild("RotateRing") as FrameworkElement; this.TransformRotate = base.GetTemplateChild("TransformRotate") as RotateTransform; if ((this.TransformRotate != null) && (this.Map != null)) { this.TransformRotate.Angle = this.Map.Rotation; } this.DrawForZoomIn = base.GetTemplateChild("DrawForZoomIn") as ToggleButton; this.EnableTogglebutton(this.DrawForZoomIn); this.DrawForZoomOut = base.GetTemplateChild("DrawForZoomOut") as ToggleButton; this.EnableTogglebutton(this.DrawForZoomOut); this.DragPan = base.GetTemplateChild("DragPan") as ToggleButton; this.EnableTogglebutton(this.DragPan); this.PreviousExtent = base.GetTemplateChild("PreviousExtent") as Button; this.NextExtent = base.GetTemplateChild("NextExtent") as Button; if (this.PreviousExtent != null) { this.PreviousExtent.Click += PreviousExtent_Click; this.PreviousExtent.Opacity = 0.3; this.PreviousExtent.IsHitTestVisible = false; } if (this.NextExtent != null) { this.NextExtent.Click += NextExtent_Click; this.NextExtent.Opacity = 0.3; this.NextExtent.IsHitTestVisible = false; } this.PanLeft = base.GetTemplateChild("PanLeft") as RepeatButton; this.PanRight = base.GetTemplateChild("PanRight") as RepeatButton; this.PanUp = base.GetTemplateChild("PanUp") as RepeatButton; this.PanDown = base.GetTemplateChild("PanDown") as RepeatButton; this.ZoomSlider = base.GetTemplateChild("ZoomSlider") as Slider; this.ZoomFullExtent = base.GetTemplateChild("ZoomFullExtent") as Button; this.ResetRotation = base.GetTemplateChild("ResetRotation") as Button; this.ZoomInButton = base.GetTemplateChild("ZoomInButton") as Button; this.ZoomOutButton = base.GetTemplateChild("ZoomOutButton") as Button; this.enablePanElement(this.PanLeft); this.enablePanElement(this.PanRight); this.enablePanElement(this.PanUp); this.enablePanElement(this.PanDown); base.FlowDirection = FlowDirection.LeftToRight; if (this.ZoomSlider != null) { if (this.Map != null) { this.SetupZoom(); } this.ZoomSlider.Minimum = 0.0; this.ZoomSlider.Maximum = 1.0; this.ZoomSlider.SmallChange = 0.01; this.ZoomSlider.LargeChange = 0.1; this.ZoomSlider.LostMouseCapture += new System.Windows.Input.MouseEventHandler(this.ZoomSlider_LostMouseCapture); this.ZoomSlider.LostFocus += new RoutedEventHandler(this.ZoomSlider_LostMouseCapture); } if (this.ZoomInButton != null) { this.ZoomInButton.Click += new RoutedEventHandler(this.ZoomInButton_Click); } if (this.ZoomOutButton != null) { this.ZoomOutButton.Click += new RoutedEventHandler(this.ZoomOutButton_Click); } if (this.RotateRing != null) { this.RotateRing.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.RotateRing_MouseLeftButtonDown); this.RotateRing.LostMouseCapture += new System.Windows.Input.MouseEventHandler(this.RotateRing_OnLostCapture); } if (this.ZoomFullExtent != null) { this.ZoomFullExtent.Click += new RoutedEventHandler(this.ZoomFullExtent_Click); } if (this.ResetRotation != null) { this.ResetRotation.Click += new RoutedEventHandler(this.ResetRotation_Click); } bool isInDesignMode = DesignerProperties.GetIsInDesignMode(this); if (isInDesignMode) { this.mouseOver = isInDesignMode; } this.ChangeVisualState(false); }
/// <summary> /// When overridden in a derived class, is invoked whenever application code or internal processes call /// <see cref="M:System.Windows.FrameworkElement.ApplyTemplate" />. /// </summary> public override void OnApplyTemplate() { base.OnApplyTemplate(); _repeatUp = GetTemplateChild(ElementNumericUp) as RepeatButton; _repeatDown = GetTemplateChild(ElementNumericDown) as RepeatButton; _valueTextBox = GetTemplateChild(ElementTextBox) as TextBox; if (_repeatUp == null || _repeatDown == null || _valueTextBox == null) { throw new InvalidOperationException(string.Format("You have missed to specify {0}, {1} or {2} in your template", ElementNumericUp, ElementNumericDown, ElementTextBox)); } this.ToggleReadOnlyMode(this.IsReadOnly); _repeatUp.Click += (o, e) => ChangeValueWithSpeedUp(true); _repeatDown.Click += (o, e) => ChangeValueWithSpeedUp(false); _repeatUp.PreviewMouseUp += (o, e) => ResetInternal(); _repeatDown.PreviewMouseUp += (o, e) => ResetInternal(); OnValueChanged(Value, Value); _scrollViewer = TryFindScrollViewer(); }
/// <summary>Initializes a new instance of the <see cref="T:System.Windows.Automation.Peers.RepeatButtonAutomationPeer" /> class.</summary> /// <param name="owner">The <see cref="T:System.Windows.Controls.Primitives.RepeatButton" /> that is associated with this <see cref="T:System.Windows.Automation.Peers.RepeatButtonAutomationPeer" />.</param> // Token: 0x060027C2 RID: 10178 RVA: 0x000B2F7E File Offset: 0x000B117E public RepeatButtonAutomationPeer(RepeatButton owner) : base(owner) { }