本文整理汇总了C#中System.Windows.DependencyPropertyKey类的典型用法代码示例。如果您正苦于以下问题:C# DependencyPropertyKey类的具体用法?C# DependencyPropertyKey怎么用?C# DependencyPropertyKey使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DependencyPropertyKey类属于System.Windows命名空间,在下文中一共展示了DependencyPropertyKey类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReverseInheritProperty
internal ReverseInheritProperty(
DependencyPropertyKey flagKey,
CoreFlags flagCache,
CoreFlags flagChanged)
: this(flagKey, flagCache, flagChanged, CoreFlags.None, CoreFlags.None)
{
}
示例2: ClearValue
/// <summary>
/// Clears the local value of the read only property.
/// </summary>
/// <param name="element">The element to clear the value to.</param>
/// <param name="key">The key for the dependency property to be cleared.</param>
public static void ClearValue(this DependencyObject element, DependencyPropertyKey key)
{
if (key == null)
return;
try
{
readonlyDPThatCanBeChanged.Add(key.DependencyProperty);
if (element != null)
element.ClearValue(key.DependencyProperty);
}
finally
{
readonlyDPThatCanBeChanged.Remove(key.DependencyProperty);
}
}
示例3: VerifyReadOnlyProperty
private static void VerifyReadOnlyProperty(DependencyProperty dependencyProperty, DependencyPropertyKey dependencyPropertyKey)
{
if (dependencyProperty.IsReadOnly &&
(dependencyPropertyKey == null || dependencyPropertyKey.DependencyProperty != dependencyProperty || !DependencyProperty.IsValidReadOnlyKey(dependencyPropertyKey)))
{
throw new Granular.Exception("Can't modify the read-only dependency property \"{0}\" without its key", dependencyProperty);
}
}
示例4: OverrideMetadata
public void OverrideMetadata (Type forType, PropertyMetadata typeMetadata, DependencyPropertyKey key)
{
if (forType == null)
throw new ArgumentNullException ("forType");
if (typeMetadata == null)
throw new ArgumentNullException ("typeMetadata");
// further checking? should we check
// key.DependencyProperty == this?
typeMetadata.DoMerge (DefaultMetadata, this, forType);
metadataByType.Add (forType, typeMetadata);
}
示例5: FrameworkPropertyMetadata
static ContentControl3D()
{
DefaultStyleKeyProperty.OverrideMetadata(
typeof (ContentControl3D),
new FrameworkPropertyMetadata(typeof (ContentControl3D)));
AnimationLengthProperty =
DependencyProperty.Register(
"AnimationLength",
typeof (int),
typeof (ContentControl3D),
new UIPropertyMetadata(600, OnAnimationLengthChanged));
BackContentProperty = DependencyProperty.Register(
"BackContent",
typeof (object),
typeof (ContentControl3D));
BackContentTemplateProperty = DependencyProperty.Register(
"BackContentTemplate",
typeof (DataTemplate),
typeof (ContentControl3D),
new UIPropertyMetadata(null));
IsFrontInViewPropertyKey = DependencyProperty.RegisterReadOnly(
"IsFrontInView",
typeof (bool),
typeof (ContentControl3D),
new UIPropertyMetadata(true));
IsFrontInViewProperty = IsFrontInViewPropertyKey.DependencyProperty;
}
示例6: TransitionControl
static TransitionControl()
{
DefaultStyleKeyProperty.OverrideMetadata(
typeof(TransitionControl),
new FrameworkPropertyMetadata(typeof(TransitionControl)));
TransitionEffectProperty = DependencyProperty.Register(
"TransitionEffect",
typeof(TransitionEffects),
typeof(TransitionControl),
new FrameworkPropertyMetadata(TransitionEffects.None));
StaleContentProperty = DependencyProperty.Register(
"StaleContent",
typeof(Object),
typeof(TransitionControl),
new FrameworkPropertyMetadata(null));
ContentControl.ContentProperty.OverrideMetadata(
typeof(TransitionControl),
new FrameworkPropertyMetadata(null, new PropertyChangedCallback(OnContentChanged)));
IsContentChangedPropertyKey = DependencyProperty.RegisterReadOnly(
"IsContentChanged",
typeof(Boolean),
typeof(TransitionControl),
new FrameworkPropertyMetadata(BooleanBoxes.FalseBox));
IsContentChangedProperty = IsContentChangedPropertyKey.DependencyProperty;
}
示例7: WaitIndicator
static WaitIndicator() {
Type ownerType = typeof(WaitIndicator);
DeferedVisibilityProperty = DependencyProperty.Register("DeferedVisibility", typeof(bool), ownerType, new PropertyMetadata(false, OnDeferedVisibilityPropertyChanged));
ShowShadowProperty = DependencyProperty.Register("ShowShadow", typeof(bool), ownerType, new PropertyMetadata(true));
ContentPaddingProperty = DependencyProperty.Register("ContentPadding", typeof(Thickness), ownerType, new PropertyMetadata(new Thickness()));
ActualContentPropertyKey = DependencyProperty.RegisterReadOnly("ActualContent", typeof(object), ownerType, new FrameworkPropertyMetadata(null));
ActualContentProperty = ActualContentPropertyKey.DependencyProperty;
}
示例8: LicensePage
/// <summary>
/// Initializes static members of the LicensePage class.
/// </summary>
static LicensePage()
{
_MustBeShownPropertyKey = DependencyProperty.RegisterReadOnly(
"MustBeShown",
typeof(bool),
typeof(LicensePage),
new PropertyMetadata(false));
MustBeShownProperty = _MustBeShownPropertyKey.DependencyProperty;
}
示例9: AutoHideChannel
static AutoHideChannel()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(AutoHideChannel), new FrameworkPropertyMetadata(typeof(AutoHideChannel)));
//Register Dependency Properties
ChannelWidthProperty = DependencyProperty.RegisterReadOnly("ChannelWidth", typeof(double), typeof(AutoHideChannel), new UIPropertyMetadata(0d));
ChannelHeightProperty = DependencyProperty.RegisterReadOnly("ChannelHeight", typeof(double), typeof(AutoHideChannel), new UIPropertyMetadata(0d));
CurrentWindowViewProperty = DependencyProperty.RegisterReadOnly("CurrentWindowView", typeof(View), typeof(AutoHideChannel), new UIPropertyMetadata(null));
}
示例10: FormulaControl
static FormulaControl()
{
var registator = new DependencyPropertyRegistator<FormulaControl>();
FormulaProperty = registator.Register<string>("Formula", propertyChanged:FormulaChanged, coerceValueCallback:OnFormulaCoerceCallback);
FormulaVisualPropertyKey = registator.RegisterReadOnly<DrawingVisual>("FormulaVisual");
EditableNowPropertyKey = registator.RegisterReadOnly<bool>("EditableNow");
FormulaVisualProperty = FormulaVisualPropertyKey.DependencyProperty;
EditableNowProperty = EditableNowPropertyKey.DependencyProperty;
}
示例11: AlignPart
static AlignPart()
{
AlignedPartsPropertyKey = DependencyProperty.RegisterReadOnly("AlignedParts", typeof(PartRefSet), typeof(AlignPart),
new PropertyMetadata(default(PartRefSet),
(o, e) =>
{
var _this = (AlignPart)o;
//_this.CoerceValue(dps.TextProperty);
}));
}
示例12: TransitionPresenter
static TransitionPresenter()
{
FrameworkElement.DefaultStyleKeyProperty.OverrideMetadata(
typeof(TransitionPresenter), new FrameworkPropertyMetadata(typeof(TransitionPresenter)));
//Registering RoutedEvents and Dependency Properties
PreviousTransitionStartedEvent = EventManager.RegisterRoutedEvent("PreviousTransitionStarted", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(TransitionPresenter));
PreviousTransitionEndedEvent = EventManager.RegisterRoutedEvent("PreviousTransitionEnded", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(TransitionPresenter));
NextTransitionStartedEvent = EventManager.RegisterRoutedEvent("NextTransitionStarted", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(TransitionPresenter));
NextTransitionEndedEvent = EventManager.RegisterRoutedEvent("NextTransitionEnded", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(TransitionPresenter));
IsSelectTransitionRunningPropertyKey = DependencyProperty.RegisterReadOnly("IsSelectTransitionRunning", typeof(bool), typeof(TransitionPresenter), new FrameworkPropertyMetadata(false, new PropertyChangedCallback(TransitionPresenter.OnIsSelectTransitionRunningChanged)));
IsSelectTransitionRunningProperty = IsSelectTransitionRunningPropertyKey.DependencyProperty;
}
示例13: DragDropViewInfo
static DragDropViewInfo() {
Type ownerType = typeof(DragDropViewInfo);
DraggingRowsPropertyKey = DependencyPropertyManager.RegisterReadOnly("DraggingRows", typeof(IList), ownerType, new UIPropertyMetadata(null));
DraggingRowsProperty = DraggingRowsPropertyKey.DependencyProperty;
DropTargetTypePropertyKey = DependencyPropertyManager.RegisterReadOnly("DropTargetType", typeof(DropTargetType), ownerType, new UIPropertyMetadata(DropTargetType.None));
DropTargetTypeProperty = DropTargetTypePropertyKey.DependencyProperty;
DropTargetRowPropertyKey = DependencyPropertyManager.RegisterReadOnly("DropTargetRow", typeof(object), ownerType, new UIPropertyMetadata(null));
DropTargetRowProperty = DropTargetRowPropertyKey.DependencyProperty;
GroupInfoPropertyKey = DependencyPropertyManager.RegisterReadOnly("GroupInfo", typeof(IList<GroupInfo>), ownerType, new UIPropertyMetadata(null));
GroupInfoProperty = GroupInfoPropertyKey.DependencyProperty;
FirstDraggingObjectPropertyKey = DependencyPropertyManager.RegisterReadOnly("FirstDraggingObject", typeof(object), ownerType, new UIPropertyMetadata(null));
FirstDraggingObjectProperty = FirstDraggingObjectPropertyKey.DependencyProperty;
}
示例14: QuickLink
// Methods
static QuickLink()
{
LinkProperty = DependencyProperty.Register("Link", typeof(IQuickLink), typeof(QuickLink), new PropertyMetadata((sender, args) => ((QuickLink)sender).UpdateIsDefault()));
IsDefaultLinkPropertyKey = DependencyProperty.RegisterReadOnly("IsDefaultLink", typeof(bool), typeof(QuickLink), new PropertyMetadata(false));
IsDefaultLinkProperty = IsDefaultLinkPropertyKey.DependencyProperty;
StripProperty = DependencyProperty.Register("Strip", typeof(MenuStrip), typeof(QuickLink), new PropertyMetadata(delegate(DependencyObject sender, DependencyPropertyChangedEventArgs args)
{
QuickLink link = (QuickLink)sender;
DependencyPropertyDescriptor descriptor = DependencyPropertyDescriptor.FromProperty(MenuStrip.DefaultLinkProperty, typeof(MenuStrip));
if (args.OldValue != null)
{
descriptor.RemoveValueChanged(args.OldValue, new EventHandler(link.DefaultLinkPropertyChanged));
MenuStrip oldValue = (MenuStrip)args.OldValue;
oldValue.MouseEnter -= new MouseEventHandler(link.Strip_MouseEnter);
oldValue.MouseLeave -= new MouseEventHandler(link.Strip_MouseLeave);
}
if (args.NewValue != null)
{
descriptor.AddValueChanged(args.NewValue, new EventHandler(link.DefaultLinkPropertyChanged));
link.UpdateIsDefault();
MenuStrip newValue = (MenuStrip)args.NewValue;
newValue.MouseEnter += new MouseEventHandler(link.Strip_MouseEnter);
newValue.MouseLeave += new MouseEventHandler(link.Strip_MouseLeave);
}
}));
NormalisedNonFocusImageProperty = DependencyProperty.Register("NormalisedNonFocusImage", typeof(ImageSource), typeof(QuickLink));
NonFocusImageProperty = DependencyProperty.Register("NonFocusImage", typeof(ImageSource), typeof(QuickLink), new PropertyMetadata(delegate(DependencyObject sender, DependencyPropertyChangedEventArgs args)
{
QuickLink link = (QuickLink)sender;
ImageSource imageSource = (ImageSource)args.NewValue;
ImageSource image = link.Link.Image;
if (((imageSource != null) && (image != null)) && ((imageSource.Width != image.Width) || (imageSource.Height != image.Height)))
{
double x = (image.Width - imageSource.Width) / 2.0;
double y = (image.Height - imageSource.Height) / 2.0;
DrawingVisual visual = new DrawingVisual();
using (DrawingContext context = visual.RenderOpen())
{
context.DrawImage(imageSource, new Rect(x, y, imageSource.Width, imageSource.Height));
}
RenderTargetBitmap bitmap = new RenderTargetBitmap((int)image.Width, (int)image.Height, 96.0, 96.0, PixelFormats.Default);
bitmap.Render(visual);
link.SetValue(NormalisedNonFocusImageProperty, bitmap);
}
else
{
link.SetValue(NormalisedNonFocusImageProperty, imageSource);
}
}));
}
示例15: TreeGridColumnHeader
static TreeGridColumnHeader()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(TreeGridColumnHeader), new FrameworkPropertyMetadata(typeof(TreeGridColumnHeader)));
ContentControl.ContentTemplateProperty.OverrideMetadata(typeof(TreeGridColumnHeader), new FrameworkPropertyMetadata(new PropertyChangedCallback(PropertyChanged)));
ContentControl.ContentTemplateSelectorProperty.OverrideMetadata(typeof(TreeGridColumnHeader), new FrameworkPropertyMetadata(new PropertyChangedCallback(PropertyChanged)));
FrameworkElement.StyleProperty.OverrideMetadata(typeof(TreeGridColumnHeader), new FrameworkPropertyMetadata(new PropertyChangedCallback(PropertyChanged)));
FrameworkElement.ContextMenuProperty.OverrideMetadata(typeof(TreeGridColumnHeader), new FrameworkPropertyMetadata(new PropertyChangedCallback(PropertyChanged)));
FrameworkElement.ToolTipProperty.OverrideMetadata(typeof(TreeGridColumnHeader), new FrameworkPropertyMetadata(new PropertyChangedCallback(PropertyChanged)));
UIElement.FocusableProperty.OverrideMetadata(typeof(TreeGridColumnHeader), new FrameworkPropertyMetadata(BooleanBoxes.False));
ColumnPropertyKey = DependencyProperty.RegisterReadOnly("Column", typeof(TreeGridColumn), typeof(TreeGridColumnHeader), null);
ColumnProperty = ColumnPropertyKey.DependencyProperty;
RolePropertyKey = DependencyProperty.RegisterReadOnly("Role", typeof(TreeGridColumnHeaderRole), typeof(TreeGridColumnHeader), new FrameworkPropertyMetadata(TreeGridColumnHeaderRole.Normal));
RoleProperty = RolePropertyKey.DependencyProperty;
}