本文整理汇总了C#中System.Windows.Controls.Primitives.ToggleButton类的典型用法代码示例。如果您正苦于以下问题:C# ToggleButton类的具体用法?C# ToggleButton怎么用?C# ToggleButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ToggleButton类属于System.Windows.Controls.Primitives命名空间,在下文中一共展示了ToggleButton类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: UpdateItemCheckedState
private void UpdateItemCheckedState(ToggleButton button,
DependencyProperty formattingProperty, object expectedValue)
{
object currentValue = rtbDocument.Selection.GetPropertyValue(formattingProperty);
button.IsChecked = (currentValue == DependencyProperty.UnsetValue) ?
false :
currentValue != null && currentValue.Equals(expectedValue);
}
开发者ID:BlueForeverI,项目名称:VirtualClassroom.TeacherClient,代码行数:8,代码来源:DocumentEditor.xaml.cs
示例17: CheckButton
public void CheckButton(ToggleButton checkedBtn)
{
foreach (ToggleButton btn in toggleBtnList)
{
if (btn == null || btn != checkedBtn)
btn.IsChecked = false;
}
}
开发者ID:npke,项目名称:my-paint-windows,代码行数:8,代码来源:ToggleButtonManager.cs
示例18: OnApplyTemplate
public override void OnApplyTemplate()
{
if (_button != null) _button.Checked -= button_Checked;
_button = GetTemplateChild("button") as ToggleButton;
if (_button != null) _button.Checked += button_Checked;
}
开发者ID:Belgrath,项目名称:CoCEd,代码行数:8,代码来源:NamedVector4Control.cs
示例19: OnApplyTemplate
public override void OnApplyTemplate() {
base.OnApplyTemplate();
_mColorPicker = GetTemplateChild("PART_ColorPicker") as ColorPicker;
_mToggleButton = GetTemplateChild("PART_ToggleButton") as ToggleButton;
if (_mColorPicker != null) {
_mColorPicker.SelectedColor = SelectedColor;
}
}
开发者ID:CyberFoxHax,项目名称:PCSXBonus,代码行数:8,代码来源:ColorComboBox.cs
示例20: switch
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
switch (connectionId)
{
case 1:
this.mainSwitch = ((System.Windows.Controls.Primitives.ToggleButton)(target));
return;
}
this._contentLoaded = true;
}
开发者ID:ychost,项目名称:PowerControlSimulation,代码行数:9,代码来源:SwitchButton.g.cs
注:本文中的System.Windows.Controls.Primitives.ToggleButton类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论