當前位置: 首頁>>代碼示例>>C#>>正文


C# Primitives.ToggleButton類代碼示例

本文整理匯總了C#中System.Windows.Controls.Primitives.ToggleButton的典型用法代碼示例。如果您正苦於以下問題:C# ToggleButton類的具體用法?C# ToggleButton怎麽用?C# ToggleButton使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ToggleButton類屬於System.Windows.Controls.Primitives命名空間,在下文中一共展示了ToggleButton類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Attach

 protected override void Attach()
 {
     _control = (ToggleButton)ControlObject;
     _control.Checked += ChangeCheck;
     _control.Unchecked += ChangeCheck;
     _control.Indeterminate += ChangeCheck;
 }
開發者ID:Roommetro,項目名稱:Friendly.WPFStandardControls,代碼行數:7,代碼來源:WPFToggleButtonGenerator.cs

示例2: OnApplyTemplate

        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            this.button = (ToggleButton)this.GetTemplateChild("PART_ToggleDropDown");
            this.popup = (Popup)this.GetTemplateChild("PART_Popup");
            this.content = (ContentControl)this.GetTemplateChild("PART_Content");
                        
            this.SizeChanged += this.DropDownButton_SizeChanged;

#if(SILVERLIGHT)
            UIElement root = Application.Current.RootVisual;
            if (root != null)
            {
                root.MouseLeftButtonDown += (s, ee) =>
                {
                    if (popup.IsOpen)
                        popup.IsOpen = false;
                };
            }
#endif

#if (!SILVERLIGHT)
            if (!System.ComponentModel.DesignerProperties.GetIsInDesignMode(this))
            {
                System.Windows.Window window = System.Windows.Window.GetWindow(this);
                window.LocationChanged += window_LocationChanged;
                window.SizeChanged += window_SizeChanged;
                LayoutUpdated += DropDownButton_LayoutUpdated;
            }

            popup.Opened += popup_Opened;
            popup.IsKeyboardFocusWithinChanged += popup_IsKeyboardFocusWithinChanged;
            FindTopLevelElement(popup).MouseDown += Outside_MouseDown;
#endif
        }
開發者ID:bbbnova,項目名稱:Orc.Toolkit,代碼行數:35,代碼來源:DropDownButton.cs

示例3: AddToggleEvent

 static void AddToggleEvent(ToggleButton toggle)
 {
     toggle.Checked += delegate
     {
         MessageBox.Show("");
     };
 }
開發者ID:Roommetro,項目名稱:Friendly.WPFStandardControls,代碼行數:7,代碼來源:WPFToggleButtonTest.cs

示例4: OnApplyTemplate

        public override void OnApplyTemplate()
        {
            if (SymbolOverlay != null)
                SymbolOverlay.MouseLeftButtonUp -= SymbolOverlay_MouseLeftButtonUp;

            if (SymbolSelector != null)
                SymbolSelector.SymbolSelected -= SymbolSelector_SymbolSelected;

            base.OnApplyTemplate();

            SymbolSelector = GetTemplateChild("SymbolSelector") as SymbolSelector;
            if (SymbolSelector != null)
                SymbolSelector.SymbolSelected += SymbolSelector_SymbolSelected;

            UniqueValueTextBlock = GetTemplateChild("UniqueValueTextBlock") as TextBlock;

            ToggleButton = GetTemplateChild("ToggleButton") as ToggleButton;

            SymbolDisplay = GetTemplateChild("SymbolDisplay") as SymbolDisplay;

            SymbolOverlay = GetTemplateChild("SymbolOverlay") as Rectangle;
            if (SymbolOverlay != null)
                SymbolOverlay.MouseLeftButtonUp += SymbolOverlay_MouseLeftButtonUp;

            if (InitCompleted != null)
                InitCompleted(this, EventArgs.Empty);
        }
開發者ID:Esri,項目名稱:arcgis-viewer-silverlight,代碼行數:27,代碼來源:UniqueValueConfigControl.cs

示例5: InitializeChildrens

		void InitializeChildrens() {
			if (expander != null)
				return;

			ToolTip = toolTipDummy;

			expander = new ToggleButton {
				Style = (Style)FindResource("ExpandCollapseToggleStyle")
			};
			icon = new Image {
				Width = 16,
				Height = 16,
				Margin = new Thickness(0, 0, 5, 1),
				VerticalAlignment = VerticalAlignment.Center,
				Focusable = false
			};
			content = new ContentPresenter {
				Margin = new Thickness(2, 0, 6, 0),
				VerticalAlignment = VerticalAlignment.Center,
				Focusable = false
			};

			expander.Checked += (sender, e) => Node.IsExpanded = true;
			expander.Unchecked += (sender, e) => Node.IsExpanded = false;

			AddVisualChild(expander);
			AddVisualChild(icon);
			AddVisualChild(content);

			UpdateChildren(Node);
		}
開發者ID:arkanoid1,項目名稱:dnSpy,代碼行數:31,代碼來源:FastTreeNodeView.cs

示例6: CheckToggleButton

 public static void CheckToggleButton(ToggleButton control, bool check)
 {
     if (control != null)
     {
         control.IsChecked = new bool?(check);
     }
 }
開發者ID:sinkers,項目名稱:silverlightplayer,代碼行數:7,代碼來源:ControlHelper.cs

示例7: ToggleButtonPropertyBinding

 /// <summary>
 /// Constructs a new toggle button property binding for the given toggle button.
 /// </summary>
 /// <param name="tglButton">The toggle button to be bound to the property.</param>
 protected ToggleButtonPropertyBinding(ToggleButton tglButton)
     : base(tglButton)
 {
     tglButton.Checked += OnStateChanged;
     tglButton.Unchecked += OnStateChanged;
     tglButton.Indeterminate += OnStateChanged;
 }
開發者ID:Xomega-Net,項目名稱:XomegaFramework,代碼行數:11,代碼來源:ToggleButtonPropertyBinding.cs

示例8: IsOn

 private bool IsOn(ToggleButton tb)
 {
     var res = Segment7.FindChild<ToggleButton>(tb.Name);
     if (res == null) res = Segment14.FindChild<ToggleButton>(tb.Name);
     if (res == null) throw new ArgumentException("Not found");
     else return (bool)res.IsChecked;
 }
開發者ID:webmaster442,項目名稱:ECalc,代碼行數:7,代碼來源:Segment714Calculator.xaml.cs

示例9: SetOption

 private static void SetOption(ToggleButton cb, ref List<string> currentOption, string option)
 {
     if (cb.IsChecked.HasValue && cb.IsChecked.Value)
     {
         currentOption.Add(option);
     }
 }
開發者ID:nagyist,項目名稱:BuildManager,代碼行數:7,代碼來源:BuildNotesOptionWnd.xaml.cs

示例10: ToggleButtonUndoOperation

 public ToggleButtonUndoOperation(ToggleButton sender, bool? oldValue, bool? newValue)
 {
     Sender = sender;
     OldValue = oldValue;
     NewValue = newValue;
     Timestamp = DateTime.UtcNow;
 }
開發者ID:JohanLarsson,項目名稱:UndoRedo,代碼行數:7,代碼來源:ToggleButtonUndoOperation.cs

示例11: DateTimePartHelper

 public DateTimePartHelper(DateTime dateTime, DateTimePart dateTimePart, NumericTextBox textBox, ToggleButton activeToggleButton)
 {
     _dateTime = dateTime;
     _textBox = textBox;
     _toggleButton = activeToggleButton;
     _dateTimePart = dateTimePart;
 }
開發者ID:sk8tz,項目名稱:Orc.Controls,代碼行數:7,代碼來源:DateTimePartHelper.cs

示例12: AttachButton

        static void AttachButton(ToggleButton trigger)
        {
            // When the ToggleButton is checked, execute the folowing code
            trigger.Checked +=
                delegate
                    {
                        // Uncheck the previous button if there is one
                        //if (ActiveButtons != null) ActiveButtons.IsChecked = false;

                        // This button is now the active button
                        //ActiveButton = trigger;
                        ActiveButtons.Add(trigger);

                        // The list is changed, so envoke the ActiveButtonsChanged event
                        ActiveButtonsChanged(null, EventArgs.Empty);
                    };

            // When the ToggleButton is unchecked, execute the folowing code
            trigger.Unchecked +=
                delegate
                    {
                        // There is no active button annymore
                        //ActiveButtons = null;
                        ActiveButtons.Remove(trigger);

                        // The list is changed, so envoke the ActiveButtonsChanged event
                        ActiveButtonsChanged(null, EventArgs.Empty);
                    };
        }
開發者ID:Klaudit,項目名稱:inbox2_desktop,代碼行數:29,代碼來源:ViewSelectedDayHelper.cs

示例13: InitializeComponent

 public void InitializeComponent()
 {
     if (!this._contentLoaded)
     {
         this._contentLoaded = true;
         Application.LoadComponent(this, new Uri("/TWC.OVP;component/Views/Shell/SportsNetworkShellView.xaml", UriKind.Relative));
         this.LayoutRoot = (Grid) base.FindName("LayoutRoot");
         this.ControllerStates = (VisualStateGroup) base.FindName("ControllerStates");
         this.ShowController = (VisualState) base.FindName("ShowController");
         this.HideController = (VisualState) base.FindName("HideController");
         this.WindowStates = (VisualStateGroup) base.FindName("WindowStates");
         this.FullScreen = (VisualState) base.FindName("FullScreen");
         this.Embedded = (VisualState) base.FindName("Embedded");
         this.CaptionSettingsStates = (VisualStateGroup) base.FindName("CaptionSettingsStates");
         this.ShowCaptionSettings = (VisualState) base.FindName("ShowCaptionSettings");
         this.HideCaptionSettings = (VisualState) base.FindName("HideCaptionSettings");
         this.BackgroundRectangle = (Rectangle) base.FindName("BackgroundRectangle");
         this.AssetViewer = (ContentControl) base.FindName("AssetViewer");
         this.Controller = (Grid) base.FindName("Controller");
         this.volumeControl = (VolumeControl) base.FindName("volumeControl");
         this.ClosedCaptioning = (ToggleButton) base.FindName("ClosedCaptioning");
         this.FullScreenGrid = (Grid) base.FindName("FullScreenGrid");
         this.FullScreenButton = (Button) base.FindName("FullScreenButton");
         this.ExitFullScreenGrid = (Grid) base.FindName("ExitFullScreenGrid");
         this.ExitFullScreenButton = (Button) base.FindName("ExitFullScreenButton");
         this.Interaction = (ContentControl) base.FindName("Interaction");
     }
 }
開發者ID:BigBri41,項目名稱:TWCTVWindowsPhone,代碼行數:28,代碼來源:SportsNetworkShellView.cs

示例14: GaneralLeds

 public GaneralLeds(ToggleButton[] debugarray, Image[] debugtxtarray, ToggleButton[] common, Image[] commontxtarray, ToggleButton[] leds, Image[] ledstxtarray, ToggleButton[] modems, Image[] modemstxtarray)
 {
     Debug = new bool[debugarray.Length];
     Common = new bool[common.Length];
     Leds = new bool[leds.Length];
     Modems = new bool[modems.Length];
     Debugtxt = debugtxtarray;
     Debugbtn = debugarray;
     Commonbtn = common;
     Commontxt = commontxtarray;
     Ledsbtn = leds;
     Ledstxt = ledstxtarray;
     Modembtn = modems;
     Modemtxt = modemstxtarray;
     foreach (ToggleButton item in Debugbtn)
     {
         item.Click += new System.Windows.RoutedEventHandler(Clicked);
     }
     foreach (ToggleButton item in Commonbtn)
     {
         item.Click += new System.Windows.RoutedEventHandler(Clicked);
     }
     foreach (ToggleButton item in Ledsbtn)
     {
         item.Click += new System.Windows.RoutedEventHandler(Clicked);
     }
     foreach (ToggleButton item in Modembtn)
     {
         item.Click += new System.Windows.RoutedEventHandler(Clicked);
     }
 }
開發者ID:liroyma,項目名稱:SpeedDetector,代碼行數:31,代碼來源:GaneralLeds.cs

示例15: ColorPicker

 public ColorPicker(Dictionary<int, Color> colorByCode, int selectedColorIndex)
 {
     this.colorByCode = colorByCode;
     double colorPickerGridWidth = radioButtonSide * elements;
     ResourceDictionary dictionary = GetResourceDictionary();
     double autoColorRadioButtonHeight = 22;
     popupBorderBrush = GetEffectBorderBrush(colorPickerGridWidth -2,autoColorRadioButtonHeight-2, Colors.White, Colors.LightSlateGray);
     pressedBorderBrush = GetEffectBorderBrush(colorPickerGridWidth - 2, autoColorRadioButtonHeight-2, Colors.LightSlateGray, Colors.White);
     autoColorRadioButton = GetAutoColorRadioButton(dictionary["AutoColorElementTemplate"] as ControlTemplate, colorPickerGridWidth, autoColorRadioButtonHeight);
     Grid colorPickerGrid = GetColorPickerGrid(colorPickerGridWidth);
     Grid.SetRow(autoColorRadioButton, 0);
     Grid.SetColumn(autoColorRadioButton, 0);
     Grid.SetColumnSpan(autoColorRadioButton, elements);
     colorPickerGrid.Children.Add(autoColorRadioButton);
     ControlTemplate colorElementTemplate = dictionary["ColorElementTemplate"] as ControlTemplate;
     Color color;
     for (int colorIndex = 0; colorIndex <= colorByCode.Keys.Max<int>(); colorIndex++)
     {
         int rowIndex = (colorIndex / elements) + 1; // в первый ряд сетки уже добавлен элемент
         int columnIndex = colorIndex % elements;
         color = colorByCode[colorIndex];
         string tip = String.Format("{0} (#{1}{2}{3})", colorIndex, color.R.ToString("X2"), color.G.ToString("X2"), color.B.ToString("X2"));
         RadioButton radioButton = GetRadioButton(colorElementTemplate, ref color, colorIndex, tip);
         Grid.SetRow(radioButton, rowIndex);
         Grid.SetColumn(radioButton, columnIndex);
         colorPickerGrid.Children.Add(radioButton);
     }
     colorPickerGrid.Height = radioButtonSide * elements + autoColorRadioButton.Height + 2;
     gridBorder = GetGridBorder(colorPickerGrid);
     topButton = GetToggleButton(dictionary["ColorPickerTopButtonTemplate"] as ControlTemplate);
     colorPickerWindow = GetColorPickerWindow(gridBorder);
     SelectedColorIndex = selectedColorIndex;
     SetRadioButtonChecked(selectedColorIndex);
     Width = 150;
 }
開發者ID:Genotoxicity,項目名稱:KSPE3Lib,代碼行數:35,代碼來源:ColorPicker.cs


注:本文中的System.Windows.Controls.Primitives.ToggleButton類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。