本文整理汇总了C#中System.Windows.Controls.Primitives.ToggleButton.AddHandler方法的典型用法代码示例。如果您正苦于以下问题:C# ToggleButton.AddHandler方法的具体用法?C# ToggleButton.AddHandler怎么用?C# ToggleButton.AddHandler使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.Primitives.ToggleButton
的用法示例。
在下文中一共展示了ToggleButton.AddHandler方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: _LoadLayout
/// <summary>
/// Loads main window layout.
/// </summary>
private void _LoadLayout()
{
// create navigation tree
_navigationTree = new NavigationTree();
// add categories buttons
foreach (INavigationItem item in _navigationTree.NaviationTreeRoot.Children)
{
if (item.Type == NavigationItemType.Page)
continue; // NOTE: skip simple pages
if (!item.IsVisible)
{
// NOTE: support only "Preferences"
Debug.Assert(item.Name.Equals("Preferences", StringComparison.OrdinalIgnoreCase));
_preferencesCategory = item;
continue; // NOTE: skip items if it not visible
}
// create new button that will be entry point to the category pages
ToggleButton button = new ToggleButton();
button.Tag = item;
button.Content = item.Caption;
button.AddHandler(ToggleButton.ClickEvent, new RoutedEventHandler(OnCategoryButtonClick));
button.Style = Application.Current.Resources["CategoriesToggleButtonStyle"] as Style;
CategoryItem category = (CategoryItem)item;
if (category.PageCategory == null)
category.PageCategory = (PageCategoryItem)Activator.CreateInstance(category.CategoryType);
// set binding to "IsEnabled" property
_SetBinding(PageCategoryItem.IS_ENABLED_PROPERTY_NAME, button, category.PageCategory, ToggleButton.IsEnabledProperty);
// set binding to "ToooltipText"
_SetBinding(PageCategoryItem.TOOLTIP_PROPERTY_NAME, button, category.PageCategory, ToggleButton.ToolTipProperty);
CategoriesButtons.AddContentItem(button);
}
_InitSavedPagesRepository();
}