本文整理汇总了C#中System.Windows.DependencyObject.SetCurrentValue方法的典型用法代码示例。如果您正苦于以下问题:C# DependencyObject.SetCurrentValue方法的具体用法?C# DependencyObject.SetCurrentValue怎么用?C# DependencyObject.SetCurrentValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.DependencyObject
的用法示例。
在下文中一共展示了DependencyObject.SetCurrentValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PrepareContainerForItemOverride
protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
{
if (element != item)
element.SetCurrentValue(DataContextProperty, item); //dont want to set the datacontext to itself. taken from MetroTabControl.cs
base.PrepareContainerForItemOverride(element, item);
}
示例2: TintPropertyChanged
private static void TintPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
{
var value = obj?.GetValue(TintProperty);
if (!(value is Color)) return;
var tint = (Color) value;
obj.SetCurrentValue(LightTintProperty, tint.Lighten(0.1f));
obj.SetCurrentValue(DarkTintProperty, tint.Darken(0.1f));
}
示例3: PrepareContainerForItemOverride
protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
{
if (!Equals(element, item))
element.SetCurrentValue(DataContextProperty, item); //dont want to set the datacontext to itself.
base.PrepareContainerForItemOverride(element, item);
}
示例4: InternalSetIsValid
internal static void InternalSetIsValid(DependencyObject obj, bool value)
{
if (GetIsValid(obj) != value)
{
// Only change the value when it is different; otherwise unnecessary binding updates are raised.
obj.SetCurrentValue(IsValidProperty, value);
}
}
示例5: Clone
private static void Clone(DependencyObject from, DependencyObject to)
{
var localValueEnumerator = from.GetLocalValueEnumerator();
while (localValueEnumerator.MoveNext())
{
if (localValueEnumerator.Current.Property.ReadOnly ||
localValueEnumerator.Current.Value is FrameworkElement) continue;
if (!(localValueEnumerator.Current.Value is BindingExpressionBase))
to.SetCurrentValue(localValueEnumerator.Current.Property, localValueEnumerator.Current.Value);
}
}
示例6: EnsureHidden
static void EnsureHidden(DependencyObject d)
{
if (Visibility.Visible.Equals(d.GetValue(UIElement.VisibilityProperty))) {
d.SetCurrentValue(UIElement.VisibilityProperty, Visibility.Hidden);
}
}
示例7: OnCellItemChanged
private static void OnCellItemChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (Equals(d.GetValue(IsUpdatingProperty), BooleanBoxes.True))
{
return;
}
d.SetCurrentValue(IsUpdatingProperty, BooleanBoxes.True);
try
{
var dataGrid = (DataGrid)d;
dataGrid.UnselectAllCells();
if (e.NewValue == null)
{
dataGrid.SetIndex(null);
return;
}
for (var r = 0; r < dataGrid.Items.Count; r++)
{
for (var c = 0; c < dataGrid.Columns.Count; c++)
{
var column = dataGrid.Columns[c];
var cellItem = GetCellItem(column, dataGrid.Items[r]);
if (Equals(cellItem, e.NewValue))
{
var index = new RowColumnIndex(r, c);
dataGrid.SetIndex(index);
var cell = dataGrid.GetCell(index);
cell.SetCurrentValue(DataGridCell.IsSelectedProperty, true);
return;
}
}
}
dataGrid.SetIndex(null);
}
finally
{
d.SetCurrentValue(IsUpdatingProperty, BooleanBoxes.False);
}
}
示例8: SetIsThreeState
/// <summary>
/// Sets the IsThreeState property. This dependency property
/// indicates whether the control supports two or three states.
/// IsChecked can be set to null as a third state when IsThreeState is true.
/// </summary>
public static void SetIsThreeState(DependencyObject d, bool value)
{
d.SetCurrentValue(IsThreeStateProperty, value);
}
示例9: OnIndexChanged
private static void OnIndexChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (Equals(d.GetValue(IsUpdatingProperty), BooleanBoxes.True))
{
return;
}
d.SetCurrentValue(IsUpdatingProperty, BooleanBoxes.True);
try
{
var dataGrid = (DataGrid)d;
dataGrid.UnselectAllCells();
var rowColumnIndex = (RowColumnIndex?)e.NewValue;
if (rowColumnIndex == null)
{
return;
}
var cell = dataGrid.GetCell(rowColumnIndex.Value);
cell?.SetCurrentValue(DataGridCell.IsSelectedProperty, true);
UpdateSelectedCellItemFromView(dataGrid);
}
finally
{
d.SetCurrentValue(IsUpdatingProperty, BooleanBoxes.False);
}
}
示例10: SetIsVirtualToggleButton
/// <summary>
/// Sets the IsVirtualToggleButton property. This dependency property
/// indicates whether the object to which the property is attached is treated as a VirtualToggleButton.
/// If true, the object will respond to keyboard and mouse input the same way a ToggleButton would.
/// </summary>
public static void SetIsVirtualToggleButton(DependencyObject d, bool value)
{
d.SetCurrentValue(IsVirtualToggleButtonProperty, value);
}
示例11: SetIsChecked
/// <summary>
/// Sets the IsChecked property. This dependency property
/// indicates whether the toggle button is checked.
/// </summary>
public static void SetIsChecked(DependencyObject d, bool? value)
{
d.SetCurrentValue(IsCheckedProperty, value);
}
示例12: SetTargetVisual
public static void SetTargetVisual(DependencyObject obj, UIElement value)
{
obj.SetCurrentValue(TargetVisualProperty, value);
}
示例13: SetDimmerOpacity
public static void SetDimmerOpacity(DependencyObject obj, double value)
{
obj.SetCurrentValue(DimmerOpacityProperty, value);
}
示例14: SetDimBackground
public static void SetDimBackground(DependencyObject obj, bool value)
{
obj.SetCurrentValue(DimBackgroundProperty, value);
}
示例15: OnSourceProxyChanged
private static void OnSourceProxyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
d.SetCurrentValue(TargetProxyProperty, e.NewValue);
}