当前位置: 首页>>代码示例>>C#>>正文


C# DependencyObject.GetOrCreateAttachedProperty方法代码示例

本文整理汇总了C#中DependencyObject.GetOrCreateAttachedProperty方法的典型用法代码示例。如果您正苦于以下问题:C# DependencyObject.GetOrCreateAttachedProperty方法的具体用法?C# DependencyObject.GetOrCreateAttachedProperty怎么用?C# DependencyObject.GetOrCreateAttachedProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DependencyObject的用法示例。


在下文中一共展示了DependencyObject.GetOrCreateAttachedProperty方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetDockAttachedProperty

 /// <summary>
 /// Returns the <c>Dock</c> attached property for the
 /// <paramref name="targetObject"/>. When this method is called,
 /// the property will be created if it is not yet attached to the
 /// <paramref name="targetObject"/>.
 /// </summary>
 /// <param name="targetObject">The object whose attached
 /// property should be returned.</param>
 /// <returns>Attached <c>Dock</c> property.</returns>
 public static AbstractProperty GetDockAttachedProperty(DependencyObject targetObject)
 {
   return targetObject.GetOrCreateAttachedProperty<Dock>(DOCK_ATTACHED_PROPERTY, Dock.Left);
 }
开发者ID:chekiI,项目名称:MediaPortal-2,代码行数:13,代码来源:DockPanel.cs

示例2: GetBottomAttachedProperty

 /// <summary>
 /// Returns the <c>Bottom</c> attached property for the
 /// <paramref name="targetObject"/>. When this method is called,
 /// the property will be created if it is not yet attached to the
 /// <paramref name="targetObject"/>.
 /// </summary>
 /// <param name="targetObject">The object whose attached
 /// property should be returned.</param>
 /// <returns>Attached <c>Bottom</c> property.</returns>
 public static AbstractProperty GetBottomAttachedProperty(DependencyObject targetObject)
 {
   return targetObject.GetOrCreateAttachedProperty<double>(BOTTOM_ATTACHED_PROPERTY, 0.0);
 }
开发者ID:joconno4,项目名称:MediaPortal-2,代码行数:13,代码来源:Canvas.cs

示例3: GetTargetNameAttachedProperty

 /// <summary>
 /// Returns the <c>TargetName</c> attached property for the
 /// <paramref name="targetObject"/>. When this method is called,
 /// the property will be created if it is not yet attached to the
 /// <paramref name="targetObject"/>.
 /// </summary>
 /// <param name="targetObject">The object whose attached
 /// property should be returned.</param>
 /// <returns>Attached <c>TargetName</c> property.</returns>
 public static AbstractProperty GetTargetNameAttachedProperty(DependencyObject targetObject)
 {
   return targetObject.GetOrCreateAttachedProperty<string>(TARGET_NAME_ATTACHED_PROPERTY, null);
 }
开发者ID:VicDemented,项目名称:MediaPortal-2,代码行数:13,代码来源:Storyboard.cs

示例4: GetRightAttachedProperty

 /// <summary>
 /// Returns the <c>Right</c> attached property for the
 /// <paramref name="targetObject"/>. When this method is called,
 /// the property will be created if it is not yet attached to the
 /// <paramref name="targetObject"/>.
 /// </summary>
 /// <param name="targetObject">The object whose attached
 /// property should be returned.</param>
 /// <returns>Attached <c>Right</c> property.</returns>
 public static AbstractProperty GetRightAttachedProperty(DependencyObject targetObject)
 {
   return targetObject.GetOrCreateAttachedProperty<double>(RIGHT_ATTACHED_PROPERTY, 0.0);
 }
开发者ID:joconno4,项目名称:MediaPortal-2,代码行数:13,代码来源:Canvas.cs

示例5: GetColumnSpanAttachedProperty

 /// <summary>
 /// Returns the <c>ColumnSpan</c> attached property for the
 /// <paramref name="targetObject"/>. When this method is called,
 /// the property will be created if it is not yet attached to the
 /// <paramref name="targetObject"/>.
 /// </summary>
 /// <param name="targetObject">The object whose attached
 /// property should be returned.</param>
 /// <returns>Attached <c>ColumnSpan</c> property.</returns>
 public static AbstractProperty GetColumnSpanAttachedProperty(DependencyObject targetObject)
 {
   return targetObject.GetOrCreateAttachedProperty<int>(COLUMNSPAN_ATTACHED_PROPERTY, 0);
 }
开发者ID:BigGranu,项目名称:MediaPortal-2,代码行数:13,代码来源:Grid.cs

示例6: GetRowAttachedProperty

 /// <summary>
 /// Returns the <c>Row</c> attached property for the
 /// <paramref name="targetObject"/>. When this method is called,
 /// the property will be created if it is not yet attached to the
 /// <paramref name="targetObject"/>.
 /// </summary>
 /// <param name="targetObject">The object whose attached
 /// property should be returned.</param>
 /// <returns>Attached <c>Row</c> property.</returns>
 public static AbstractProperty GetRowAttachedProperty(DependencyObject targetObject)
 {
   return targetObject.GetOrCreateAttachedProperty<int>(ROW_ATTACHED_PROPERTY, 0);
 }
开发者ID:BigGranu,项目名称:MediaPortal-2,代码行数:13,代码来源:Grid.cs

示例7: GetStateSlotAttachedProperty

 /// <summary>
 /// Returns the attached property instance for the <c>WorkflowContext.StateSlot</c> property.
 /// </summary>
 /// <remarks>
 /// <para>
 /// If the <c>WorkflowContext.StateSlot</c> property is set to a context name for a UI element, that element and
 /// all its children will save their state in the current MediaPortal 2 workflow navigation context in the context variable of
 /// the given name when the current screen is quit and restore the state when the screen is reloaded for the same
 /// workflow navigation context.
 /// </para>
 /// <para>
 /// The usage is like this:
 /// <example>
 /// <code>
 /// &lt;ListView
 ///     xmlns:mp_special_workflow="clr-namespace:MediaPortal.UI.SkinEngine.SpecialElements.Workflow;assembly=SkinEngine"
 ///     ...
 ///     mp_special_workflow:WorkflowContext.StateSlot="MainMenu"&gt;
 ///   ...
 /// &lt;/ListView&gt;
 /// </code>
 /// </example>
 /// </para>
 /// </remarks>
 /// <param name="targetObject">The object whose attached property should be returned.</param>
 /// <returns>Attached <c>SaveState</c> property.</returns>
 public static AbstractProperty GetStateSlotAttachedProperty(DependencyObject targetObject)
 {
   AbstractProperty result = targetObject.GetAttachedProperty(STATE_SLOT_ATTACHED_PROPERTY);
   if (result != null)
     return result;
   result = targetObject.GetOrCreateAttachedProperty(STATE_SLOT_ATTACHED_PROPERTY, string.Empty);
   IWorkflowManager workflowManager = ServiceRegistration.Get<IWorkflowManager>();
   // We save the workflow navigation context at the time when this attached property is requested because that is the time when
   // the navigation context is the right one for the current screen. At the time when the Screen.HIDE_EVENT is raised,
   // the navigation context has already moved to the next state.
   NavigationContext context = workflowManager.CurrentNavigationContext;
   result.Attach((prop, oldVal) => OnStateSlotChanged(targetObject, context, (string) prop.GetValue()));
   return result;
 }
开发者ID:davinx,项目名称:MediaPortal-2,代码行数:40,代码来源:WorkflowContext.cs

示例8: GetGroupContextAttachedProperty

 /// <summary>
 /// Returns the <c>GroupContext</c> attached property for the
 /// <paramref name="targetObject"/>. When this method is called,
 /// the property will be created if it is not yet attached to the
 /// <paramref name="targetObject"/>.
 /// </summary>
 /// <param name="targetObject">The object whose attached
 /// property should be returned.</param>
 /// <returns>Attached <c>GroupContext</c> property.</returns>
 public static AbstractProperty GetGroupContextAttachedProperty(DependencyObject targetObject)
 {
   return targetObject.GetOrCreateAttachedProperty<string>(GROUPCONTEXT_ATTACHED_PROPERTY, string.Empty);
 }
开发者ID:davinx,项目名称:MediaPortal-2,代码行数:13,代码来源:RadioButton.cs


注:本文中的DependencyObject.GetOrCreateAttachedProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。