本文整理汇总了C#中DependencyObject.CoerceValue方法的典型用法代码示例。如果您正苦于以下问题:C# DependencyObject.CoerceValue方法的具体用法?C# DependencyObject.CoerceValue怎么用?C# DependencyObject.CoerceValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DependencyObject
的用法示例。
在下文中一共展示了DependencyObject.CoerceValue方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnMinPageWidthChanged
/// <summary>
/// Respond to MinPageWidth change.
/// </summary>
private static void OnMinPageWidthChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
d.CoerceValue(MaxPageWidthProperty);
d.CoerceValue(PageWidthProperty);
}
示例2: OnMaxPageHeightChanged
/// <summary>
/// Respond to MaxPageHeight change.
/// </summary>
private static void OnMaxPageHeightChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
d.CoerceValue(PageHeightProperty);
}
示例3: OnIsEnabledChanged
private static void OnIsEnabledChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
d.CoerceValue(CanUserAddRowsProperty);
d.CoerceValue(CanUserDeleteRowsProperty);
// Many commands use IsEnabled to determine if they are enabled or not
CommandManager.InvalidateRequerySuggested();
((DataGrid)d).UpdateVisualState();
}
示例4: OnRowStyleSelectorChanged
private static void OnRowStyleSelectorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
d.CoerceValue(ItemContainerStyleSelectorProperty);
}
示例5: OnIsReadOnlyChanged
private static void OnIsReadOnlyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if ((bool)e.NewValue)
{
// When going from R/W to R/O, cancel any current edits
((DataGrid)d).CancelAnyEdit();
}
// re-evalutate the BeginEdit command's CanExecute.
CommandManager.InvalidateRequerySuggested();
d.CoerceValue(CanUserAddRowsProperty);
d.CoerceValue(CanUserDeleteRowsProperty);
// Affects the IsReadOnly property on cells
OnNotifyColumnAndCellPropertyChanged(d, e);
}
示例6: OnViewboxChanged
/// <summary>
/// Handles the event that occurs when the value of the <see cref="Viewbox"/> dependency property has changed.
/// </summary>
/// <param name="d">The dependency object on which the dependency property has changed.</param>
/// <param name="e">The event args containing the old and new values of the dependency property.</param>
private static void OnViewboxChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
d.CoerceValue(ScaleProperty);
d.CoerceValue(OffsetProperty);
}
示例7: OnStretchDirectionChanged
/// <summary>
/// Handles the event that occurs when the value of the <see cref="StretchDirection"/> dependency property has changed.
/// </summary>
/// <param name="d">The dependency object on which the dependency property has changed.</param>
/// <param name="e">The event args containing the old and new values of the dependency property.</param>
private static void OnStretchDirectionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
d.CoerceValue(ScaleProperty);
d.CoerceValue(OffsetProperty);
}
示例8: OnScaleChanged
/// <summary>
/// Handles the event that occurs when the value of the <see cref="Scale"/> dependency property has changed.
/// </summary>
/// <param name="d">The dependency object on which the dependency property has changed.</param>
/// <param name="e">The event args containing the old and new values of the dependency property.</param>
private static void OnScaleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
d.CoerceValue(ActualViewboxProperty);
d.CoerceValue(OffsetProperty);
var canvas = d as ZoomableCanvas;
if (canvas != null)
{
canvas.ScaleOverride((double)e.NewValue);
}
}
示例9: OnApplyTransformChanged
/// <summary>
/// Handles the event that occurs when the value of the <see cref="ApplyTransform"/> dependency property has changed.
/// </summary>
/// <param name="d">The dependency object on which the dependency property has changed.</param>
/// <param name="e">The event args containing the old and new values of the dependency property.</param>
private static void OnApplyTransformChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
d.CoerceValue(RenderTransformProperty);
}