File size: 9,661 Bytes
8c763fb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | // Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#region StyleCop Suppression - generated code
using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
namespace Microsoft.Management.UI.Internal
{
/// <summary>
/// This control provides basic functionality for Picker-like controls.
/// </summary>
/// <remarks>
///
///
/// If a custom template is provided for this control, then the template MUST provide the following template parts:
///
/// PART_DropDown - A required template part which must be of type DismissiblePopup. The dropdown which hosts the picker.
/// PART_DropDownButton - A required template part which must be of type ToggleButton. The ToggleButton which controls whether the dropdown is open.
///
/// </remarks>
[TemplatePart(Name="PART_DropDown", Type=typeof(DismissiblePopup))]
[TemplatePart(Name="PART_DropDownButton", Type=typeof(ToggleButton))]
[Localizability(LocalizationCategory.None)]
partial class PickerBase
{
//
// Fields
//
private DismissiblePopup dropDown;
private ToggleButton dropDownButton;
//
// CloseDropDown routed command
//
/// <summary>
/// Informs the PickerBase that it should close the dropdown.
/// </summary>
public static readonly RoutedCommand CloseDropDownCommand = new RoutedCommand("CloseDropDown",typeof(PickerBase));
static private void CloseDropDownCommand_CommandExecuted(object sender, ExecutedRoutedEventArgs e)
{
PickerBase obj = (PickerBase) sender;
obj.OnCloseDropDownExecuted( e );
}
/// <summary>
/// Called when CloseDropDown executes.
/// </summary>
/// <remarks>
/// Informs the PickerBase that it should close the dropdown.
/// </remarks>
protected virtual void OnCloseDropDownExecuted(ExecutedRoutedEventArgs e)
{
OnCloseDropDownExecutedImplementation(e);
}
partial void OnCloseDropDownExecutedImplementation(ExecutedRoutedEventArgs e);
//
// DropDownButtonTemplate dependency property
//
/// <summary>
/// Identifies the DropDownButtonTemplate dependency property.
/// </summary>
public static readonly DependencyProperty DropDownButtonTemplateProperty = DependencyProperty.Register( "DropDownButtonTemplate", typeof(ControlTemplate), typeof(PickerBase), new PropertyMetadata( null, DropDownButtonTemplateProperty_PropertyChanged) );
/// <summary>
/// Gets or sets a value that controls the visual tree of the DropDown button.
/// </summary>
[Bindable(true)]
[Category("Common Properties")]
[Description("Gets or sets a value that controls the visual tree of the DropDown button.")]
[Localizability(LocalizationCategory.None)]
public ControlTemplate DropDownButtonTemplate
{
get
{
return (ControlTemplate) GetValue(DropDownButtonTemplateProperty);
}
set
{
SetValue(DropDownButtonTemplateProperty,value);
}
}
static private void DropDownButtonTemplateProperty_PropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
{
PickerBase obj = (PickerBase) o;
obj.OnDropDownButtonTemplateChanged( new PropertyChangedEventArgs<ControlTemplate>((ControlTemplate)e.OldValue, (ControlTemplate)e.NewValue) );
}
/// <summary>
/// Occurs when DropDownButtonTemplate property changes.
/// </summary>
public event EventHandler<PropertyChangedEventArgs<ControlTemplate>> DropDownButtonTemplateChanged;
/// <summary>
/// Called when DropDownButtonTemplate property changes.
/// </summary>
protected virtual void OnDropDownButtonTemplateChanged(PropertyChangedEventArgs<ControlTemplate> e)
{
OnDropDownButtonTemplateChangedImplementation(e);
RaisePropertyChangedEvent(DropDownButtonTemplateChanged, e);
}
partial void OnDropDownButtonTemplateChangedImplementation(PropertyChangedEventArgs<ControlTemplate> e);
//
// DropDownStyle dependency property
//
/// <summary>
/// Identifies the DropDownStyle dependency property.
/// </summary>
public static readonly DependencyProperty DropDownStyleProperty = DependencyProperty.Register( "DropDownStyle", typeof(Style), typeof(PickerBase), new PropertyMetadata( null, DropDownStyleProperty_PropertyChanged) );
/// <summary>
/// Gets or sets the style of the drop-down.
/// </summary>
[Bindable(true)]
[Category("Common Properties")]
[Description("Gets or sets the style of the drop-down.")]
[Localizability(LocalizationCategory.None)]
public Style DropDownStyle
{
get
{
return (Style) GetValue(DropDownStyleProperty);
}
set
{
SetValue(DropDownStyleProperty,value);
}
}
static private void DropDownStyleProperty_PropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
{
PickerBase obj = (PickerBase) o;
obj.OnDropDownStyleChanged( new PropertyChangedEventArgs<Style>((Style)e.OldValue, (Style)e.NewValue) );
}
/// <summary>
/// Occurs when DropDownStyle property changes.
/// </summary>
public event EventHandler<PropertyChangedEventArgs<Style>> DropDownStyleChanged;
/// <summary>
/// Called when DropDownStyle property changes.
/// </summary>
protected virtual void OnDropDownStyleChanged(PropertyChangedEventArgs<Style> e)
{
OnDropDownStyleChangedImplementation(e);
RaisePropertyChangedEvent(DropDownStyleChanged, e);
}
partial void OnDropDownStyleChangedImplementation(PropertyChangedEventArgs<Style> e);
//
// IsOpen dependency property
//
/// <summary>
/// Identifies the IsOpen dependency property.
/// </summary>
public static readonly DependencyProperty IsOpenProperty = DependencyProperty.Register( "IsOpen", typeof(bool), typeof(PickerBase), new PropertyMetadata( BooleanBoxes.FalseBox, IsOpenProperty_PropertyChanged) );
/// <summary>
/// Gets or sets a value indicating whether the Popup is visible.
/// </summary>
[Bindable(true)]
[Category("Common Properties")]
[Description("Gets or sets a value indicating whether the Popup is visible.")]
[Localizability(LocalizationCategory.None)]
public bool IsOpen
{
get
{
return (bool) GetValue(IsOpenProperty);
}
set
{
SetValue(IsOpenProperty,BooleanBoxes.Box(value));
}
}
static private void IsOpenProperty_PropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
{
PickerBase obj = (PickerBase) o;
obj.OnIsOpenChanged( new PropertyChangedEventArgs<bool>((bool)e.OldValue, (bool)e.NewValue) );
}
/// <summary>
/// Occurs when IsOpen property changes.
/// </summary>
public event EventHandler<PropertyChangedEventArgs<bool>> IsOpenChanged;
/// <summary>
/// Called when IsOpen property changes.
/// </summary>
protected virtual void OnIsOpenChanged(PropertyChangedEventArgs<bool> e)
{
OnIsOpenChangedImplementation(e);
RaisePropertyChangedEvent(IsOpenChanged, e);
}
partial void OnIsOpenChangedImplementation(PropertyChangedEventArgs<bool> e);
/// <summary>
/// Called when a property changes.
/// </summary>
private void RaisePropertyChangedEvent<T>(EventHandler<PropertyChangedEventArgs<T>> eh, PropertyChangedEventArgs<T> e)
{
if (eh != null)
{
eh(this,e);
}
}
//
// OnApplyTemplate
//
/// <summary>
/// Called when ApplyTemplate is called.
/// </summary>
public override void OnApplyTemplate()
{
PreOnApplyTemplate();
base.OnApplyTemplate();
this.dropDown = WpfHelp.GetTemplateChild<DismissiblePopup>(this,"PART_DropDown");
this.dropDownButton = WpfHelp.GetTemplateChild<ToggleButton>(this,"PART_DropDownButton");
PostOnApplyTemplate();
}
partial void PreOnApplyTemplate();
partial void PostOnApplyTemplate();
//
// Static constructor
//
/// <summary>
/// Called when the type is initialized.
/// </summary>
static PickerBase()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(PickerBase), new FrameworkPropertyMetadata(typeof(PickerBase)));
CommandManager.RegisterClassCommandBinding( typeof(PickerBase), new CommandBinding( PickerBase.CloseDropDownCommand, CloseDropDownCommand_CommandExecuted ));
StaticConstructorImplementation();
}
static partial void StaticConstructorImplementation();
}
}
#endregion
|