本文整理汇总了C#中Windows.UI.Xaml.UIElement.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# UIElement.SetValue方法的具体用法?C# UIElement.SetValue怎么用?C# UIElement.SetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Windows.UI.Xaml.UIElement
的用法示例。
在下文中一共展示了UIElement.SetValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetEdge
public static void SetEdge(UIElement element, Edge edge)
{
if (element == null)
{
throw new ArgumentNullException("element");
}
element.SetValue(EdgeProperty, edge);
}
示例2: SetBindings
public static void SetBindings(UIElement element, ObservableCollection<EventBinding> value)
{
var existingCollection = (ObservableCollection<EventBinding>)element.GetValue(BindingsProperty);
if (existingCollection != null)
existingCollection.Clear(); //Cause all existing bound events to be unbound
if (value != null)
value.CollectionChanged += (s, e) => OnCollectionChanged(e, element);
element.SetValue(BindingsProperty, value);
}
示例3: GetBindings
public static VisualStateBindingCollection GetBindings(UIElement element)
{
var bindingCollection = element.GetValue(BindingsProperty) as VisualStateBindingCollection;
if (bindingCollection == null)
{
bindingCollection = new VisualStateBindingCollection();
element.SetValue(BindingsProperty, bindingCollection);
}
return bindingCollection;
}
示例4: SetShowScrollbarAtBreakpointOffset
public static void SetShowScrollbarAtBreakpointOffset(UIElement element, double value)
{
element.SetValue(ShowScrollbarAtBreakpointOffsetProperty, value);
if (value > 0)
{
var sv = (ScrollViewer) element;
sv.ViewChanging += SvOnViewChanging;
}
else
{
var sv = (ScrollViewer)element;
sv.ViewChanging -= SvOnViewChanging;
}
}
示例5: SetLoadMore
public static void SetLoadMore(UIElement element, EventHandler value)
{
element.SetValue(LoadMoreProperty, value);
var sv = element as ScrollViewer;
if (sv != null)
{
sv.ViewChanged += (sender, args) =>
{
var verticalOffsetValue = sv.VerticalOffset;
var maxVerticalOffsetValue = sv.ExtentHeight - sv.ViewportHeight;
if (maxVerticalOffsetValue < 0 || Math.Abs(verticalOffsetValue - maxVerticalOffsetValue) < 1.0)
{
value.Invoke(sv, EventArgs.Empty);
}
};
}
}
示例6: ReInitAccentColorChanged
internal static void ReInitAccentColorChanged()
{
if (_currentListenElement != null && _listenToken.HasValue)
{
_currentListenElement.UnregisterPropertyChangedCallback(SolidColorBrush.ColorProperty, _listenToken.Value);
}
if (_currentListenElement == null)
{
_currentListenElement = Window.Current.Content;
if (_currentListenElement != null)
{
var accentColorBrush = (SolidColorBrush)XamlReader.Load("<SolidColorBrush xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" Color=\"{ThemeResource SystemAccentColor}\" />");
_listenToken = accentColorBrush.RegisterPropertyChangedCallback(SolidColorBrush.ColorProperty, (obj, dp) =>
{
if (AccentColorChanged != null)
{
var accentColor = (Color)obj.GetValue(dp);
AccentColorChanged(obj, accentColor);
}
});
_currentListenElement.SetValue(AccentColorBrushProperty, accentColorBrush);
}
}
}
示例7: SetHelpText
/// <summary>
/// Sets the help text of the attached element.
/// </summary>
/// <param name="element">UIElement instance.</param>
/// <param name="helpText">Help text.</param>
public static void SetHelpText(UIElement element, string helpText)
{
element.SetValue(HelpFrame.HelpTextProperty, helpText);
}
示例8: SetSectionTemplate
public static void SetSectionTemplate(UIElement element, DataTemplate value)
{
element.SetValue(SectionTemplateProperty, value);
}
示例9: SetAlignment
/// <summary>
/// Sets a value indicating the alignment of the help frame on top of the associated element.
/// </summary>
/// <param name="element">Associated element.</param>
/// <param name="value">Value of the HelpFrameAlignment enumeration.</param>
public static void SetAlignment(UIElement element, HelpFrameAlignment value)
{
element.SetValue(AlignmentProperty, value);
}
示例10: SetBitmapImageSource
public static void SetBitmapImageSource(UIElement element, BitmapImage value)
{
element.SetValue(FileProperty, value);
}
示例11: SetHeaderTemplate
public static void SetHeaderTemplate(UIElement element, DataTemplate value)
{
element.SetValue(HeaderTemplateProperty, value);
}
示例12: SetLayer
/// <summary>
/// Sets the internal HelpLayer instance to attach to the root layout panel of the page.
/// </summary>
/// <param name="element">UIElement element.</param>
/// <param name="value">HelpLayer instance.</param>
private static void SetLayer(UIElement element, HelpLayer value)
{
element.SetValue(LayerProperty, value);
}
示例13: SetIsTiltEnabled
/// <summary>Sets a value indicating whether to enable tilt effect for the <see cref="UIElement"/>. </summary>
/// <param name="element">The element. </param>
/// <param name="value">The value. </param>
public static void SetIsTiltEnabled(UIElement element, bool value)
{
element.SetValue(IsTiltEnabledProperty, value);
}
示例14: SetRotateLeft
public static void SetRotateLeft(UIElement element, CompositeTransform value)
{
element.SetValue(RotateProperty, value);
}
示例15: SetWidth
public static void SetWidth(UIElement element, double value)
{
element.SetValue(WidthProperty, value);
}