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


C# DependencyObject.CoerceValue方法代码示例

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


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

示例1: OnTimeSpanPropertyChanged

		static void OnTimeSpanPropertyChanged(DependencyObject dp, DependencyPropertyChangedEventArgs e)
		{
			
			TimePicker timePicker = dp as TimePicker;

			if (e.Property == TimeSpanProperty)
			{
				if (timePicker != null)
				{
					if (timePicker.TimeSpan.Days > 0)
					{
						if (timePicker.IsFullDay)
							timePicker.TextBox.Text = "24:00";
						else timePicker.TextBox.Text = "23:59";
					}
					else timePicker.TextBox.Text = timePicker.TimeSpan.Hours.ToString("D2") + ":" + timePicker.TimeSpan.Minutes.ToString("D2");
				}
				dp.CoerceValue(TimeSpanProperty);
			}
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:20,代码来源:TimePicker.xaml.cs

示例2: UpdateDefaultControlSizeDefinition

        private static void UpdateDefaultControlSizeDefinition(DependencyObject d)
        {
            d.CoerceValue(DefaultControlSizeDefinitionProperty);

            // If the element belongs to a ControlGroup, then
            // coerce DefaultControlSizeDefinition for the ControlGroup too.
            if (RibbonControlService.GetIsInControlGroup(d))
            {
                RibbonControlGroup controlGroup = TreeHelper.FindVisualAncestor<RibbonControlGroup>(d);
                if (controlGroup != null)
                {
                    controlGroup.CoerceValue(DefaultControlSizeDefinitionProperty);
                }
            }
        }
开发者ID:amitkr2007,项目名称:groups-dct-sms,代码行数:15,代码来源:RibbonControlService.cs

示例3: OnValueChanged

        /// <summary>
        /// Handles changes to the Value property.
        /// </summary>
        private static void OnValueChanged(DependencyObject d,
            DependencyPropertyChangedEventArgs e)
        {
            d.CoerceValue(MinimumProperty);
            d.CoerceValue(MaximumProperty);
            StarControl starControl = (StarControl)d;
            if (starControl.Value == 0.0m)
            {
                starControl.starForeground.Fill = Brushes.Gray;
            }
            else
            {
                starControl.starForeground.Fill = starControl.StarForegroundColor;
            }

            Int32 marginLeftOffset = (Int32)(starControl.Value * (Decimal)STAR_SIZE);
            starControl.mask.Margin = new Thickness(marginLeftOffset, 0, 0, 0);
            starControl.InvalidateArrange();
            starControl.InvalidateMeasure();
            starControl.InvalidateVisual();
        }
开发者ID:steve600,项目名称:VersatileMediaManager,代码行数:24,代码来源:StarControl.xaml.cs

示例4: OnMinimumChanged

 private static void OnMinimumChanged(DependencyObject element, DependencyPropertyChangedEventArgs args)
 {
     element.CoerceValue(MaximumProperty);
       element.CoerceValue(ValueProperty);
 }
开发者ID:edealbag,项目名称:bot,代码行数:5,代码来源:NumericUpDown.cs

示例5: TransferProperty

 /// <summary>
 ///     Causes the given DependencyProperty to be coerced in transfer mode.
 /// </summary>
 /// <remarks>
 ///     This should be called from within the target object's NotifyPropertyChanged.  It MUST be called in
 ///     response to a change in the target property.
 /// </remarks>
 /// <param name="d">The DependencyObject which contains the property that needs to be transfered.</param>
 /// <param name="p">The DependencyProperty that is the target of the property transfer.</param>
 public static void TransferProperty(DependencyObject d, DependencyProperty p)
 {
     var transferEnabledMap = GetPropertyTransferEnabledMapForObject(d);
     transferEnabledMap[p] = true;
     d.CoerceValue(p);
     transferEnabledMap[p] = false;
 }
开发者ID:kasicass,项目名称:kasicass,代码行数:16,代码来源:PropertyHelper.cs

示例6: RestoreValue

 private static void RestoreValue(DependencyObject d, DependencyProperty property, ValueAndValueSource v)
 {
     Debug.Assert(d != null);
     Debug.Assert(property != null);
     Debug.Assert(v != null);
     if (v.ValueSource == BaseValueSource.Local)
     {
         d.SetValue(property, v.Value);
     }
     else
     {
         d.ClearValue(property);
         d.CoerceValue(property);
     }
 }
开发者ID:kasicass,项目名称:kasicass,代码行数:15,代码来源:RibbonHelper.cs

示例7: OnCommandChanged

 // Performs proper hooking/unhooking and coerces QAT ID.
 //
 // All Ribbon controls should hook this delegate to coerce the QAT ID whenever the Command changes.
 internal static void OnCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     d.CoerceValue(RibbonControlService.QuickAccessToolBarIdProperty);
 }
开发者ID:kasicass,项目名称:kasicass,代码行数:7,代码来源:RibbonHelper.cs

示例8: OnRowStyleSelectorChanged

 private static void OnRowStyleSelectorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     d.CoerceValue(ItemContainerStyleSelectorProperty);
 }
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:4,代码来源:DataGrid.cs

示例9: OnPositionChanged

 private static void OnPositionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     d.CoerceValue(PositionProperty);
     (d as MediaSeekSlider).Value = (d as MediaSeekSlider).Position;
 }
开发者ID:jstarpl,项目名称:PlayoutAutomation,代码行数:5,代码来源:MediaSeekSlider.cs

示例10: OnCategoryTemplateChanged

 private static void OnCategoryTemplateChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     d.CoerceValue(ItemTemplateProperty);
 }
开发者ID:kasicass,项目名称:kasicass,代码行数:4,代码来源:RibbonGallery.cs

示例11: OnCategoryStyleChanged

 private static void OnCategoryStyleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     d.CoerceValue(ItemContainerStyleProperty);
 }
开发者ID:kasicass,项目名称:kasicass,代码行数:4,代码来源:RibbonGallery.cs

示例12: StupidDIckheadPropertyHCanged

 private static void StupidDIckheadPropertyHCanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
 {
     ErrorProvider p = e.NewValue as ErrorProvider;
     p.Errors.CollectionChanged +=
         delegate(object sender, NotifyCollectionChangedEventArgs nce) {
             o.CoerceValue(HasErrorMessageProperty);
             o.CoerceValue(ErrorMessageProperty);
         };
 }
开发者ID:PaulStovell,项目名称:trial-balance,代码行数:9,代码来源:ErrorMessageProvider.cs

示例13: IsToolWindowChanged

 private static void IsToolWindowChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     d.CoerceValue(CanRaftProperty);
     d.CoerceValue(CanBecomeDocumentProperty);
     d.CoerceValue(DefaultDockProperty);
 }
开发者ID:Mrding,项目名称:Ribbon,代码行数:6,代码来源:DockingWindowMetadata.cs

示例14: OnDefaultControlSizeDefinitionChanged

 private static void OnDefaultControlSizeDefinitionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     d.CoerceValue(ControlSizeDefinitionProperty);
 }
开发者ID:amitkr2007,项目名称:groups-dct-sms,代码行数:4,代码来源:RibbonControlService.cs

示例15: CoerceControlSizeDefinition

 private static object CoerceControlSizeDefinition(DependencyObject d, object baseValue)
 {
     if (baseValue == null)
     {
         RibbonControlSizeDefinition defaultControlSizeDefinition = RibbonControlService.GetDefaultControlSizeDefinition(d);
         if (defaultControlSizeDefinition == null)
         {
             d.CoerceValue(DefaultControlSizeDefinitionProperty);
             defaultControlSizeDefinition = RibbonControlService.GetDefaultControlSizeDefinition(d);
         }
         return defaultControlSizeDefinition;
     }
     return baseValue;
 }
开发者ID:amitkr2007,项目名称:groups-dct-sms,代码行数:14,代码来源:RibbonControlService.cs


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