Inheritance: ItemsControl, ISelector
        public void UpdateMenuList()
        {
            _menuItems = new List<SelectorItem>();

            // fill the local menu items collection for later use
            if (this.IsPanSelectorEnabled)
            {
                var border = (Border)this.PaneRoot.Children[0];
                _menuHost = border.Child as Selector;

                if (_menuHost == null)
                {
                    var panel = border.Child as RelativePanel;
                    _menuHost = panel.Children[0] as Selector;
                }

                if (_menuHost == null)
                {
                    throw new ArgumentException("For the bottom panning to work, the Pane's Child needs to be of type Selector!!");
                }

                foreach (var item in _menuHost.Items)
                {
                    var container = (SelectorItem)_menuHost.ContainerFromItem(item);
                    _menuItems.Add(container);
                }

                _distancePerItem = TOTAL_PANNING_DISTANCE / _menuItems.Count;

                // calculate the initial starting distance
                _startingDistance = _distancePerItem * _menuHost.SelectedIndex;
            }
        }
 private void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
 {
     selector = UIMixin.FindAncestor<Selector>(this);
     selector.SelectionChanged += SelectorOnSelectionChanged;
     if (selector.SelectedItem != null)
     {
         InvalidateArrange();
     }
 }
        /// <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();
            _captureElement = (CaptureElement)GetTemplateChild(CaptureElementName);

            if (MediaCapture != null)
            {
                _captureElement.Source = MediaCapture;
            }

            _webCamSelectorPopup = GetTemplateChild(WebCamSelectorPopupName) as Popup;
            _webCamSelector = GetTemplateChild(WebCamSelectorName) as Selector;
            _recordingIndicator = GetTemplateChild(RecordingIndicatorName) as LayoutPanel;
            _recordingAnimation = GetTemplateChild(RecordingAnimationName) as Storyboard;
            _countdownControl = GetTemplateChild(CountdownControlName) as CountdownControl;
            _flashAnimation = GetTemplateChild(FlashAnimationName) as Storyboard;
        }
示例#4
0
        void OnPaneRootLoaded(object sender, RoutedEventArgs e)
        {
            // fill the local menu items collection for later use
            if (IsPanSelectorEnabled)
            {
                var border = (Border)PaneRoot.Children[0];
                _menuHost = border.Child as Selector;

                if (_menuHost == null)
                {
                    throw new ArgumentException("For the bottom panning to work, the Pane's Child needs to be of type Selector!!");
                }

                foreach (var item in _menuHost.Items)
                {
                    var container = (SelectorItem)_menuHost.ContainerFromItem(item);
                    _menuItems.Add(container);
                }

                _distancePerItem = TOTAL_PANNING_DISTANCE / _menuItems.Count;

                // calculate the initial starting distance
                _startingDistance = _distancePerItem * _menuHost.SelectedIndex;
            }
        }
 private void SwitchToNextScrollMode()
 {
     _currentMode++;
     if (_currentMode > Selector.Local_Pressure)
     {
         _currentMode = Selector.Local_Temp;
     }
 }
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            DetachSelectionChanged();

            _daySelector = GetTemplateChild(DaySelectorPartName) as Selector;
            _monthSelector = GetTemplateChild(MonthSelectorPartName) as Selector;
            _yearSelector = GetTemplateChild(YearSelectorPartName) as Selector;
            _dateHelperSelector = GetTemplateChild(DateHelperSelectorPartName) as Selector;

            if (_daySelector == null)
                throw new Exception("Could not find template part: " + DaySelectorPartName);
            if (_monthSelector == null)
                throw new Exception("Could not find template part: " + MonthSelectorPartName);
            if (_yearSelector == null)
                throw new Exception("Could not find template part: " + YearSelectorPartName);
            if (_dateHelperSelector == null)
                throw new Exception("Could not find template part: " + DateHelperSelectorPartName);

            AttachSelectionChanged();

            FillSelectors();
            UpdateSelection();
        }
示例#7
0
 private void ClearListSelector(Selector showSelector, bool changeSelectedIndex)
 {
     if (showSelector == null)
     {
         if (changeSelectedIndex)
             recentList.SelectedIndex = favList.SelectedIndex = channelTypeGridView.SelectedIndex = -1;
         LeftCommands.Visibility =  unPinToStartAppBar.Visibility = Visibility.Collapsed;
         BottomAppBar.IsSticky = false;
         BottomAppBar.IsOpen = false;
     }
     else
     {
         if (showSelector == channelTypeGridView)
         {
             if (changeSelectedIndex)
                 favList.SelectedIndex = recentList.SelectedIndex = -1;
             LeftCommands.Visibility = Visibility.Collapsed;
             unPinToStartAppBar.Visibility = Visibility.Visible;
         }
         else
         {
             if (changeSelectedIndex)
             {
                 if (recentList != showSelector)
                     recentList.SelectedIndex = -1;
                 else
                     favList.SelectedIndex = -1;
                 channelTypeGridView.SelectedIndex = -1;
             }
             LeftCommands.Visibility = Visibility.Visible;
             unPinToStartAppBar.Visibility = Visibility.Collapsed;
         }
         BottomAppBar.IsSticky = true;
         BottomAppBar.IsOpen = true;
     }
 }
 public SelectorEvents(Selector This)
     : base(This)
 {
     this.This = This;
 }