Наследование: ButtonBase, IToggleButton, IToggleButtonOverrides
Пример #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (_lastButton != null)
            {
                _lastButton.IsChecked = false;
                _lastButton = null;
            }
            if(_lastPanel!= null)
            {
                _lastPanel.Visibility = Visibility.Collapsed;
                _lastPanel = null;
            }

            _lastButton = sender as ToggleButton;
            var tag = _lastButton.Tag as string;

            switch (tag)
            {
                case "Search": _lastPanel = _searchPanel; break;
                case "Bibles": _lastPanel = _bibleListPanel; break;
                case "BibleBooks": _lastPanel = _bibleBookListPanel; break;
                default: throw new Exception("Button [" + tag + "] not yet supported");
            }

            _lastPanel.Visibility = Visibility.Visible;
        }
Пример #2
0
 private void SetupButtonGrid() {
     var gridSize = GridLogic.GridSize;
     // calculating button height
     var scaleFactor = DisplayInformation.GetForCurrentView().RawPixelsPerViewPixel;
     var buttonSize = Window.Current.Bounds.Width * scaleFactor / gridSize;
     // setting up rows and columns
     for (var i = 0; i < gridSize; i++) {
         var colDef = new ColumnDefinition {
             Width = new GridLength(1, GridUnitType.Star)
         };
         MainButtonsGrid.ColumnDefinitions.Add(colDef);
     }
     for (var i = 0; i < gridSize; i++) {
         var rowDef = new RowDefinition {
             Height = new GridLength(1, GridUnitType.Star)
         };
         MainButtonsGrid.RowDefinitions.Add(rowDef);
     }
     // obtaining buttons content - a shameful workaround
     var buttonStrings = _resLoader.GetString("MainButtonsContent").Split(';');
     // creating and adding buttons
     _mainButtons = new ToggleButton[gridSize * gridSize];
     for (var i = 0; i < gridSize; i++) {
         for (var j = 0; j < gridSize; j++) {
             var bIndex = i * gridSize + j;
             var b = new ToggleButton {
                 HorizontalAlignment = HorizontalAlignment.Stretch,
                 VerticalAlignment = VerticalAlignment.Stretch,
                 Height = buttonSize,
                 Width = buttonSize
             };
             b.SetValue(Grid.RowProperty, i);
             b.SetValue(Grid.ColumnProperty, j);
             b.Padding = new Thickness(0);
             b.Margin = new Thickness(0, -11, 0, -11);
             // setting button content
             var textBlock = new TextBlock {
                 TextWrapping = TextWrapping.Wrap,
                 FontSize = 14,
                 FontStretch = Windows.UI.Text.FontStretch.ExtraCondensed,
                 Text = buttonStrings[bIndex]
             };
             b.HorizontalContentAlignment = HorizontalAlignment.Left;
             b.Padding = new Thickness(4, 1, 1, 1);
             b.Content = textBlock;
             // adding OnClickListener
             b.Tag = bIndex;
             b.Click += mainButton_Click;
             // saving the button and adding to grid
             _mainButtons[bIndex] = b;
             MainButtonsGrid.Children.Add(b);
         }
     }
 }
Пример #3
0
        public void SetSource(LiveListItem liveItem)
        {
            this.DataContext = liveItem;

            if (_lastSelectBtn != null)
                _lastSelectBtn.IsChecked = false;
            _lastSelectBtn = btntoday;
            _lastSelectBtn.IsChecked = true;
            _liveInfo = liveItem;
            _paradeTime = DateTime.Now.ToString("yyyy-MM-dd");

            RequestDatas();
        }
Пример #4
0
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            _playButton = GetTemplateChild(PlayButtonName) as ToggleButton;
            _stopButton = GetTemplateChild(StopButtonName) as Button;
            _fullButton = GetTemplateChild(FullButtonName) as ToggleButton;
            _muteButton = GetTemplateChild(MuteButtonName) as ToggleButton;
            _volumeBar = GetTemplateChild(VolumeBarName) as ProgressBar;
            _scheduleBar = GetTemplateChild(ScheduleBarName) as ProgressBar;

            _loaded = true;
            SetStates();
        }
 internal static void SplitViewPaneHandler(EventMainPage page, SplitView rootSplitView,
     ToggleButton togglePaneButton)
 {
     if (rootSplitView.DisplayMode == SplitViewDisplayMode.Inline ||
         rootSplitView.DisplayMode == SplitViewDisplayMode.Overlay)
     {
         var transform = togglePaneButton.TransformToVisual(page);
         var rect =
             transform.TransformBounds(new Rect(0, 0, togglePaneButton.ActualWidth,
                 togglePaneButton.ActualHeight));
         page.TogglePaneButtonRect = rect;
     }
     else
     {
         page.TogglePaneButtonRect = new Rect();
     }
 }
Пример #6
0
 public void RestoreSettings(ApplicationDataCompositeValue settings)
 {
     if (settings.ContainsKey("MenuButton"))
     {
         if (settings["MenuButton"] != null)
         {
             switch (settings["MenuButton"] as string)
             {
                 case "Search": _lastButton = _searchButton; _lastPanel = _searchPanel; break;
                 case "Bibles": _lastButton = _biblesButton; _lastPanel = _bibleListPanel; break;
                 case "BibleBooks": _lastButton = _biblesBookButton; _lastPanel = _bibleBookListPanel; break;
             }
             _lastButton.IsChecked = true;
             _lastPanel.Visibility = Visibility.Visible;
         }
     }
 }
Пример #7
0
        protected override void OnApplyTemplate()
        {
            _expanderButton = GetTemplateChild(StringConstants.ExpanderToggleButtonPart) as ToggleButton;
            _headerButton = GetTemplateChild(StringConstants.HeaderButtonPart) as ButtonBase;
            _mainContentRow = GetTemplateChild(StringConstants.MainContentRowPart) as RowDefinition;

            if (_expanderButton != null)
            {
                _expanderButton.Checked += OnExpanderButtonChecked;
                _expanderButton.Unchecked += OnExpanderButtonUnChecked;
                _expanderButton.IsChecked = IsExpanded;
                if (IsExpanded)
                    ExpandControl();
                else
                    CollapseControl();
            }

            if (_headerButton != null)
            {
                _headerButton.Click += OnHeaderButtonClick;
            }
        }
Пример #8
0
 public static void SetAssociatedToggle( DependencyObject obj, ToggleButton value )
 {
     obj.SetValue( AssociatedToggleProperty, value );
 }
Пример #9
0
        /// <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();

            _popup = (Popup)GetTemplateChild(POPUP_PART);
            _button = (Button)GetTemplateChild(BUTTON_PART);
            _toggleButton = (ToggleButton)GetTemplateChild(TOGGLE_BUTTON_PART);

            if (IsToggle)
            {
                InitToggleBehavior();
            }
            else
            {
                InitButtonBehavior();
            }

            //Remove parent's popup
            var parent = (Panel)_popup.Parent;
            parent.Children.Remove(_popup);

            _popup.Closed += _popup_Closed;
        }
Пример #10
0
        private void UnloadControl(InputType type)
        {

            if (type == InputType.text)
            {
                _udfTB1.KeyUp -= ittext_KeyUp;
                
            }
            else if (type == InputType.password)
            {
                _udfPB1.PasswordChanged -= itpassword_PasswordChanged;
            }
            else if (type == InputType.checkbox)
            {

            }
            else if (type == InputType.radio)
            {

            }
            else if (type == InputType.combobox)
            {
                if (_ccInput != null) {
                    var sp = (Grid)_ccInput.Content;
                    var cb = (ComboBox)sp.Children[1];
                    cb.SelectionChanged -= itcombobox_SelectionChanged;
                    Value2 = null;
                    //if (cb.Items != null && cb.Items.Count > 0) cb.Items.Clear();
                    //if (cb.ItemsSource != null) cb.ItemsSource = null;
                }
            }
            if (_udfTS1 != null) {
                _udfTS1.Toggled -= ittoggleswitch_Toggled;
            }
            if (_udfProgBr1 != null)
            {
                _udfProgBr1.ValueChanged -= itProgBr_ValueChanged;
            }
            if (_udfSl1 != null)
            {
                _udfSl1.ValueChanged -= itSl_ValueChanged;
            }
            if (_udfRB1 != null)
            {
                _udfRB1.Checked -= itradio_Changed;
                _udfRB1.Unchecked -= itradio_Changed;
            }
            if (_udfChkB1 != null)
            {
                _udfChkB1.Checked -= itcheckbox_Changed;
                _udfChkB1.Unchecked -= itcheckbox_Changed;
            }
            if (_udfTBut1 != null)
            {
                _udfTBut1.Checked -= ittogglebutton_changed;
                _udfTBut1.Unchecked -= ittogglebutton_changed;
            }
            if (_udfProgRn1 != null)
            {
                _udfProgRn1.IsActive = false;
            }
            if (_udfg1 != null)
            {
                _udfg1.Children.Clear();
                _udfg1 = null;
            }

            if (dtInvalidate != null) {
                dtInvalidate.Stop();
                dtInvalidate.Tick += DtInvalidate_Tick;
            }

            _sbHideBgLayer?.Stop();
            _sbHideBgLayer = null;
            _sbShowBgLayer?.Stop();
            _sbShowBgLayer = null;

            _udfProgBr1 = null;
            _udfPB1 = null;
            _udfTB1 = null;
            _udfTBL1 = null;
            _udfCB1 = null;
            _udfChkB1 = null;
            _udfRB1 = null;
            _udfTS1 = null;
            _udfProgRn1 = null;
            _udfTBut1 = null;
            dtInvalidate = null;
            if (_ccInput != null && _ccInput.Content != null) _ccInput.Content = null;
            if (_ccInput != null) _ccInput = null;
            _grdContainer = null;
            if (_grdRoot != null) { _grdRoot.DataContext = null; _grdRoot = null; }
            _model = null;
            hasInitialized = false;
        }
        private ToggleButton CreateButton(Sensor sensor, SensorData data)
        {
            ToggleButton button = new ToggleButton
            {
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Margin = new Thickness(5),
               
            };
            button.Tag = String.Format("{0};{1};{2}",
                sensor.ownerNodeId,
                sensor.sensorId,
                data.dataType.ToString());

            button.Click += button_Click;
            button.IsChecked = data.state == "1";
            button.Content = (button.IsChecked.Value) ? "ON" : "OFF";

            return button;
        }
Пример #12
0
        private void Button_OnChecked(object sender, RoutedEventArgs e)
        {
            TerrainViewModel item = ((ToggleButton)sender).DataContext as TerrainViewModel;
            Selected = item;

            ToggleButton selectedTool = sender as ToggleButton;
            if (_prevSelected != null)
                _prevSelected.IsChecked = false;
            _prevSelected = selectedTool;
        }
Пример #13
0
        public GlobalMenuControl()
        {
            InitializeComponent();
            DataContext = this;
            MyGrid = GlobalGrid;
            MyPlayerGrid = PlayerGrid;
            PlayerButton = MyPlayerToggleButton;
            GlobalGrid.Children.Add(new News());

            _navigationService = new NavigationService();
            HardwareButtons.BackPressed += HardwareButtonsOnBackPressed;
            MyPlayerToggleButton = PlayerToggleButton;
            story = MenuStoryBoardBack;
            playerStoryboard = PlayerStoryBoard;
            playerStoryboard.Completed += PlayerStoryboardOnCompleted;
            playerStoryboardBack = PlayerStoryBoardBack;
            playerStoryboardBack.Completed += PlayerStoryboardBackOnCompleted;
            toggle = ToggleButtonSearch;
            MenuToggleButton = ToggleButtonMenu;
            MenuToggleButton.Style = Application.Current.Resources["MenuToggleStyle"] as Style;

            ProfilButton.Command = new RelayCommand(GoToProfil);
            NewsButton.Command = new RelayCommand(GoToNews);
            ExplorerButton.Command = new RelayCommand(GoToExplorer);
            PacksButton.Command = new RelayCommand(GoToPacks);
            MondeMusicalButton.Command = new RelayCommand(GoToMondeMusical);
            BattleButton.Command = new RelayCommand(GoToBattle);
            PlaylistButton.Command = new RelayCommand(GoToPlaylist);
            AmisButton.Command = new RelayCommand(GoToAmis);
            AchatButton.Command = new RelayCommand(GoToAchat);
            ConnexionButton.Command = new RelayCommand(GoToConnexionPage);
            APropos.Command = new RelayCommand(GoToAbout);

            CreateFile();

            dispatcherTimer = new DispatcherTimer();
            dispatcherTimer.Tick += DispatcherTimerOnTick;
            dispatcherTimer.Interval = new TimeSpan(0, 0, 10);
            dispatcherTimer.Start();
            i = 0;
        }
        private void Parent_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e)
        {
            if (SelectedTool == InkingToolMode.Annotate)
            {
                Point position = e.GetPosition(null);
                // Find if we're intersecting with the toolbar, because we don't want annotation screens there.
                IEnumerable<UIElement> intersectedElements = VisualTreeHelper.FindElementsInHostCoordinates(position, _inkToolbar);
                // Check what elements of the sender we're on top of. If there's a button, we'll intersect with our toggle button collection
                // to confirm whether we'd like to simply 'hittest' that button.
                IEnumerable<UIElement> allIntersectedElements = VisualTreeHelper.FindElementsInHostCoordinates(position, (UIElement)sender);

                // Not intersected with the toolbar and no togglebuttons (of ours) in the way indicating there's another annotation, go ahead
                // and create the XAML.
                if (intersectedElements.Count() == 0 && (AnnotationTogglers.Intersect(allIntersectedElements.OfType<ButtonBase>())).Count() == 0)
                {
                    var panel = new Grid { Width = 300, Height = 200 };
                    StackPanel collapsingPanel = new StackPanel { Orientation = Orientation.Horizontal };
                    var toggleButtonText = new TextBlock { DataContext = this, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center };
                    var toggleButtonId = "tb" + Guid.NewGuid().ToString();
                    var toggleButtonContent = new Grid();
                    toggleButtonContent.Children.Add(toggleButtonText);
                    toggleButtonContent.Children.Add(new FontIcon { FontFamily = new FontFamily("Segoe MDL2 Assets"), Glyph = "\uE70B" });
                    var toggleButton = new ToggleButton { Content = new Viewbox { Child = toggleButtonContent }, Name = toggleButtonId, RenderTransform = new TranslateTransform { X = -10 }, Width = 32, Height = 32, Template = null, VerticalAlignment = VerticalAlignment.Top };
                    toggleButton.AddHandler(ToggleButton.PointerPressedEvent, new PointerEventHandler(ToggleButton_PointerPressed), true);
                    toggleButton.AddHandler(ToggleButton.PointerReleasedEvent, new PointerEventHandler(ToggleButton_PointerReleased), true);
                    toggleButton.AddHandler(ToggleButton.PointerMovedEvent, new PointerEventHandler(ToggleButton_PointerMoved), true);

                    toggleButton.PointerReleased += ToggleButton_PointerReleased;
                    AnnotationTogglers.Add(toggleButton);
                    toggleButtonText.SetBinding(TextBlock.TextProperty, new Binding { Path = new PropertyPath("AnnotationTogglers"), Converter = listIndexerConverter, ConverterParameter = toggleButtonId, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged });
                    collapsingPanel.Children.Add(toggleButton);

                    var innerGrid = new Grid();

                    CommandBar richTextEditBar = new CommandBar();
                    var boldButton = new AppBarButton { Label = "Bold", Icon = new SymbolIcon(Symbol.Bold) };
                    // TODO: remove when destroyed
                    boldButton.Click += BoldButton_Click;
                    richTextEditBar.PrimaryCommands.Add(boldButton);
                    var italicButton = new AppBarButton { Label = "Italic", Icon = new SymbolIcon(Symbol.Italic) };
                    // TODO: remove when destroyed
                    italicButton.Click += ItalicButton_Click;
                    richTextEditBar.PrimaryCommands.Add(italicButton);

                    innerGrid.Children.Add(new RichEditBox { Header = richTextEditBar, Width = 200 });
                    var deleteIcon = new FontIcon { Name = "deleteIcon", FontFamily = new FontFamily("Segoe MDL2 Assets"), Glyph = "\uE74D", Margin = new Thickness(0, 0, 5, 5), HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Bottom };
                    deleteIcon.Tapped += new Windows.UI.Xaml.Input.TappedEventHandler((o, a) => { DeleteAnnotation(panel); });
                    innerGrid.Children.Add(deleteIcon);
                    innerGrid.SetBinding(Grid.VisibilityProperty, new Binding { ElementName = toggleButton.Name, Path = new PropertyPath("IsChecked"), Converter = booleanToVisibilityConverter });
                    collapsingPanel.Children.Add(innerGrid);
                    panel.Children.Add(collapsingPanel);

                    Canvas.SetLeft(panel, position.X);
                    Canvas.SetTop(panel, position.Y);

                    _annotationCanvas.Children.Add(panel);
                }
            }
        }
Пример #15
0
 private async void pbtn_Click(object sender, RoutedEventArgs e)
 {
     StorageFolder folder = KnownFolders.PicturesLibrary;
     ToggleButton tb = new ToggleButton();
     tb.Style = tbstyle;
     tb.Content = folder.Name;
     tb.Click += Tb_Click;
     cislo = tlist.Count;
     tb.Name = cislo.ToString();
     tlist.Add(tb);
     uncheckothers(cislo);
     customtitlebar.Children.Add(tlist[cislo]);
     folders.Add(new List<StorageFolder>());
     cisla.Add(0);
     await show(folder);
     updatewidth(pg.DesiredSize.Width);
 }
Пример #16
0
        private void BuildControl(InputType type, string label, string placeholderText, double labelFontSize, double labelTranslateY, string groupName, ContentControl ccInput) {

            FrameworkElement fe = null;

            if (type == InputType.text)
            {
                _udfTB1 = new TextBox();
                _udfTB1.PlaceholderText = placeholderText;
                _udfTB1.Style = _GeneralTextBoxStyle;
                _udfTB1.SetBinding(TextBox.DataContextProperty, new Binding() { Path= new PropertyPath("{x:Null}") });
                _udfTB1.SetBinding(TextBox.TextProperty, new Binding() { Source = Value });
                _udfTB1.KeyUp += ittext_KeyUp;

                _udfg1 = new Grid() { Padding = new Thickness(2, 2, 2, 2), HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment= VerticalAlignment.Top};
                _udfTBL1 = new TextBlock();
                _udfTBL1.Text = label;
                _udfTBL1.FontSize = labelFontSize;
                _udfg1.Margin = new Thickness(0, labelTranslateY, 0, 0);
                _udfg1.Visibility = Visibility.Collapsed;
                _udfg1.Children.Add(_udfTBL1);
                
                var gd = new Grid();
                gd.Children.Add(_udfg1);
                gd.Children.Add(_udfTB1);

                fe = gd;
            }
            else if (type == InputType.password)
            {
                _udfPB1 = new PasswordBox();
                _udfPB1.PlaceholderText = placeholderText;
                _udfPB1.Style = _GeneralPasswordBoxStyle;
                _udfPB1.PasswordChanged += itpassword_PasswordChanged;

                _udfg1 = new Grid() { Padding = new Thickness(2, 2, 2, 2), HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top };
                _udfTBL1 = new TextBlock();
                _udfTBL1.Text = label;
                _udfTBL1.FontSize = labelFontSize;
                _udfg1.Margin = new Thickness(0, labelTranslateY, 0, 0);
                _udfg1.Visibility = Visibility.Collapsed;
                _udfg1.Children.Add(_udfTBL1);

                var gd = new Grid();
                gd.Children.Add(_udfg1);
                gd.Children.Add(_udfPB1);

                fe = gd;
            }
            else if (type == InputType.combobox)
            {
                _udfCB1 = new ComboBox();
                _udfCB1.Style = _GeneralComboBoxStyle;
                _udfCB1.PlaceholderText = placeholderText;
                _udfCB1.SetBinding(ComboBox.ItemsSourceProperty, new Binding() { Source = Items });
                _udfCB1.Width = this.Width;
                _udfCB1.SelectionChanged += itcombobox_SelectionChanged;

                _udfg1 = new Grid() { Padding = new Thickness(2, 2, 2, 2), HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top };
                _udfTBL1 = new TextBlock();
                _udfTBL1.Text = label;
                _udfTBL1.FontSize = labelFontSize;
                _udfg1.Margin = new Thickness(0, labelTranslateY, 0, 0);
                _udfg1.Visibility = Visibility.Collapsed;
                _udfg1.Children.Add(_udfTBL1);

                var gd = new Grid();
                gd.Children.Add(_udfg1);
                gd.Children.Add(_udfCB1);

                fe = gd;
            }
            else if (type == InputType.checkbox)
            {
                var sp = new StackPanel();
                sp.Orientation = Orientation.Horizontal;
                
                var lb = new TextBlock();
                lb.Text = label;
                lb.FontSize = LabelFontSize;
                lb.Margin = new Thickness(0, LabelTranslateY, 0, 0);

                _udfChkB1 = new CheckBox();
                _udfChkB1.Checked += itcheckbox_Changed;
                _udfChkB1.Unchecked += itcheckbox_Changed;
                _udfChkB1.Content = lb;
                _udfChkB1.Style = _GeneralCheckBoxStyle;
                sp.Children.Add(_udfChkB1);

                fe = sp;
            }
            else if (type == InputType.toggleButton)
            {
                _udfTBut1 = new ToggleButton();
                _udfTBut1.Style = _GeneralToggleButtonStyle;
                _udfTBut1.Checked += ittogglebutton_changed;
                _udfTBut1.Unchecked += ittogglebutton_changed;
                _udfTBut1.FontSize = FontSize;
                _udfTBut1.Content = Content1;
                fe = _udfTBut1;
            }
            else if (type == InputType.toggleSwitch)
            {
                _udfTS1 = new ToggleSwitch();
                _udfTS1.Style = _GeneralToggleSwitchStyle;
                _udfTS1.Toggled += ittoggleswitch_Toggled;
                _udfTS1.FontSize = FontSize;
                _udfTS1.OnContent = Content1;
                _udfTS1.OffContent = Content2;
                fe = _udfTS1;
            }
            else if (type == InputType.radio)
            {
                var sp = new StackPanel();
                sp.Orientation = Orientation.Horizontal;
                
                var lb = new TextBlock();
                lb.Text = label;
                lb.FontSize = LabelFontSize;
                lb.Margin = new Thickness(0, LabelTranslateY, 0, 0);

                _udfRB1 = new RadioButton();
                _udfRB1.GroupName = groupName;
                _udfRB1.Checked += itradio_Changed;
                _udfRB1.Unchecked += itradio_Changed;
                _udfRB1.Content = lb;
                _udfRB1.Style = _GeneralRadioButtonStyle;
                sp.Children.Add(_udfRB1);

                fe = sp;
            }
            else if (type == InputType.progress)
            {
                _udfProgBr1 = new ProgressBar();
                _udfProgBr1.Style = _GeneralProgressBarStyle;
                _udfProgBr1.ValueChanged += itProgBr_ValueChanged;
                _udfProgBr1.FontSize = FontSize;
                _udfProgBr1.DataContext = this;
                _udfProgBr1.SetBinding(ProgressBar.MaximumProperty, new Binding() { Path= new PropertyPath("Maximum1") });
                _udfProgBr1.SetBinding(ProgressBar.MinimumProperty, new Binding() { Path = new PropertyPath("Minimum1") });
                _udfProgBr1.SetBinding(ProgressBar.ValueProperty, new Binding() { Path = new PropertyPath("Value1")  });
                _udfProgBr1.SetBinding(ProgressBar.SmallChangeProperty, new Binding() { Path = new PropertyPath("SmallChange1") });
                _udfProgBr1.SetBinding(ProgressBar.LargeChangeProperty, new Binding() { Path = new PropertyPath("LargeChange1") });
                
                fe = _udfProgBr1;
            }
            else if (type == InputType.progressRing)
            {
                _udfProgRn1 = new ProgressRing();
                _udfProgRn1.Style = _GeneralProgressRingStyle;
                //_udfProgRn1.val += itProgBr_ValueChanged;
                _udfProgRn1.FontSize = FontSize;
                _udfProgRn1.DataContext = this;
                _udfProgRn1.SetBinding(ProgressRing.IsActiveProperty, new Binding() { Path = new PropertyPath("IsActive") });

                fe = _udfProgRn1;
            }
            else if (type == InputType.slider)
            {
                _udfSl1 = new Slider();
                _udfSl1.Style = _GeneralSliderStyle;
                _udfSl1.ValueChanged += itSl_ValueChanged;
                _udfSl1.FontSize = FontSize;
                _udfSl1.DataContext = this;
                _udfSl1.SetBinding(Slider.MaximumProperty, new Binding() { Path = new PropertyPath("Maximum1") });
                _udfSl1.SetBinding(Slider.MinimumProperty, new Binding() { Path = new PropertyPath("Minimum1") });
                _udfSl1.SetBinding(Slider.ValueProperty, new Binding() { Path = new PropertyPath("Value1") });
                _udfSl1.SetBinding(Slider.SmallChangeProperty, new Binding() { Path = new PropertyPath("SmallChange1") });
                _udfSl1.SetBinding(Slider.StepFrequencyProperty, new Binding() { Path = new PropertyPath("SmallChange1") });
                _udfSl1.SetBinding(Slider.LargeChangeProperty, new Binding() { Path = new PropertyPath("LargeChange1") });

                fe = _udfSl1;
            }



            fe.HorizontalAlignment = HorizontalAlignment.Stretch;
            fe.VerticalAlignment = VerticalAlignment.Stretch;
            ccInput.Content = fe;

        }
 /// <summary>Called when [apply template].</summary>
 protected override void OnApplyTemplate()
 {
     if (_toggleButton != null)
     {
         _toggleButton.Checked -= ToggleButtonChecked;
         _toggleButton.Unchecked -= ToggleButtonUnchecked;
     }
     base.OnApplyTemplate();
     _collapsedAnimation = GetTemplateChild(CollapsedAnimationPartName) as DoubleAnimation;
     _expandedAnimation = GetTemplateChild(ExpandedAnimationPartName) as DoubleAnimation;
     _toggleButton = GetTemplateChild(ToggleButtonPartName) as ToggleButton;
     if (_toggleButton != null)
     {
         _toggleButton.Checked += ToggleButtonChecked;
         _toggleButton.Unchecked += ToggleButtonUnchecked;
         _toggleButton.IsChecked = IsExpanded;
     }
 }
Пример #18
0
        private static void NumberOfStarsValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            RatingBar parent = sender as RatingBar;
            Int32 NumberOfStarsValue = (Int32)e.NewValue;

            for (int i = 1; i <= NumberOfStarsValue; i++)
            {
                var btn = new ToggleButton()
                {
                    Tag = i,
                    Height = parent.HeightValue,
                    Style = parent.Resources["StarButton"] as Style,
                    Foreground = parent.StarForegroundColor
                };
                btn.Click += parent.RatingButtonClickEventHandler;
                btn.PointerEntered += parent.ToggleButton_DragEnter;
                parent.StackRootPanel.Children.Add(btn);
            }
        }
Пример #19
0
        private void toggleButton_Click(object sender, RoutedEventArgs e)
        {
             var button = sender as ToggleButton;
             if (button != null)
             {
                 _lastSelectBtn.IsChecked = false;
                 _lastSelectBtn = button;
                 _lastSelectBtn.IsChecked = true;
                 _paradeTime = button.Content.ToString();

                 RequestDatas();
             }
        }
 public ToggleButtonEvents(ToggleButton This)
     : base(This)
 {
     this.This = This;
 }