本文整理汇总了C#中Windows.UI.Xaml.FrameworkElement.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# FrameworkElement.SetValue方法的具体用法?C# FrameworkElement.SetValue怎么用?C# FrameworkElement.SetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Windows.UI.Xaml.FrameworkElement
的用法示例。
在下文中一共展示了FrameworkElement.SetValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetBehaviors
/// <summary>
/// Gets the <see cref="T:System.Windows.Interactivity.BehaviorCollection"/> associated with a specified object.
///
/// </summary>
/// <param name="obj">The object from which to retrieve the <see cref="T:System.Windows.Interactivity.BehaviorCollection"/>.</param>
/// <returns>
/// A <see cref="T:System.Windows.Interactivity.BehaviorCollection"/> containing the behaviors associated with the specified object.
/// </returns>
public static BehaviorCollection GetBehaviors(FrameworkElement obj)
{
BehaviorCollection behaviorCollection = (BehaviorCollection)obj.GetValue(Interaction.BehaviorsProperty);
if (behaviorCollection == null)
{
behaviorCollection = new BehaviorCollection();
obj.SetValue(Interaction.BehaviorsProperty, behaviorCollection);
}
return behaviorCollection;
}
示例2: GetOrCreateBindingsList
private IList<IMvxUpdateableBinding> GetOrCreateBindingsList(FrameworkElement attachedObject)
{
var existing = attachedObject.GetValue(BindingsListProperty) as IList<IMvxUpdateableBinding>;
if (existing != null)
return existing;
// attach the list
var newList = new List<IMvxUpdateableBinding>();
attachedObject.SetValue(BindingsListProperty, newList);
// create a binding watcher for the list
#if WINDOWS_WPF
var binding = new System.Windows.Data.Binding();
#endif
#if WINDOWS_COMMON
var binding = new Windows.UI.Xaml.Data.Binding();
#endif
bool attached = false;
Action attachAction = () =>
{
if (attached)
return;
BindingOperations.SetBinding(attachedObject, DataContextWatcherProperty, binding);
attached = true;
};
Action detachAction = () =>
{
if (!attached)
return;
#if WINDOWS_COMMON
attachedObject.ClearValue(DataContextWatcherProperty);
#else
BindingOperations.ClearBinding(attachedObject, DataContextWatcherProperty);
#endif
attached = false;
};
attachAction();
attachedObject.Loaded += (o, args) =>
{
attachAction();
};
attachedObject.Unloaded += (o, args) =>
{
detachAction();
};
return newList;
}
示例3: ShowItem
internal void ShowItem(ContainerContentChangingEventArgs args, FrameworkElement item)
{
item.SetValue(FrameworkElement.DataContextProperty, DependencyProperty.UnsetValue);
item.Opacity = 1;
}
示例4: HideItem
internal void HideItem(FrameworkElement item)
{
item.SetValue(FrameworkElement.DataContextProperty, null);
item.Opacity = 0;
}
示例5: SetMargin
public static void SetMargin(FrameworkElement target, Thickness value) {
target.SetValue(MarginProperty, value);
}
示例6: SetObservedHeight
public static void SetObservedHeight(FrameworkElement frameworkElement, double observedHeight)
{
frameworkElement.SetValue(ObservedHeightProperty, observedHeight);
}
示例7: SetObserve
public static void SetObserve(FrameworkElement frameworkElement, bool observe)
{
frameworkElement.SetValue(ObserveProperty, observe);
}
示例8: SetAttachedPopup
/// <summary>
/// 将一个 FullWindowPopup 附加到一个 FrameworkElement 上。
/// </summary>
/// <param name="obj">被附加的 FrameworkElement。</param>
/// <param name="value">附加的 FullWindowPopup。</param>
public static void SetAttachedPopup(FrameworkElement obj, FullWindowPopup value)
{
obj.SetValue(AttachedPopupProperty, value);
}
示例9: SetContent
public static void SetContent(FrameworkElement d, object v) {
d.SetValue(ContentProperty, v);
}
示例10: SetCommandParameter
public static void SetCommandParameter(FrameworkElement target, object value) {
target.SetValue(CommandParameterProperty, value);
}
示例11: SetEventArgsAsParameter
public static void SetEventArgsAsParameter(FrameworkElement target, bool value) {
target.SetValue(EventArgsAsParameterProperty, value);
}
示例12: SetCommand
public static void SetCommand(FrameworkElement target, ICommand value) {
target.SetValue(CommandProperty, value);
}
示例13: SetEvent
public static void SetEvent(FrameworkElement target, string value) {
target.SetValue(EventProperty, value);
}
示例14: applyQuadrant
private void applyQuadrant(FrameworkElement ctl, string qlocation, int width, int height, bool preSized = false)
{
Grid parent;
int row;
int col;
string loc;
Tuple<int, int> quad;
parent = FindParentOrCreate(qlocation);
// Now we will be able to add the new control to the right place.
loc = qlocation.Substring(qlocation.Length - 1, 1);
quad = TranslateQLoc(loc);
row = quad.Item1;
col = quad.Item2;
if (width > 0 && !preSized)
ctl.Width = width * ((IIFControl)ctl).WidthOfAChar;
else if (!preSized)
ctl.HorizontalAlignment = HorizontalAlignment.Stretch;
if (height > 0 && !preSized)
ctl.Height = height * ((IIFControl)ctl).HeightOfAChar;
else if (!preSized)
ctl.VerticalAlignment = VerticalAlignment.Stretch;
ctl.Name = kCtlName + qlocation; // +"__" + parent.Children.Count;
if (parent.Children.Count > 0)
{
var existing = parent.Children.FirstOrDefault(i => (int)i.GetValue(Grid.ColumnProperty) == col && (int)i.GetValue(Grid.RowProperty) == row);
// Need to find an existing element that is in our spot
if (existing is Grid)
{
// tried to place where there is a grid.
// Try to place in exact spot in the grid we found
applyQuadrant(ctl, qlocation + qlocation.Substring(qlocation.Length - 1, 1), width, height, true);
return;
}
if (existing != null)
{
var ctlNum = controls.IndexOf((FrameworkElement)existing);
splitCell(parent, ctlNum, ctl, "");
return;
}
// else fall through to insert
// moveControlToGrid((FrameworkElement)parent.Children[0]);
// var newparent = (Grid)parent.Children[0];
// newparent.Children.Add(ctl);
// ctl.SetValue(Grid.RowProperty, 1);
// ctl.SetValue(Grid.ColumnProperty, 0);
}
parent.Children.Add(ctl);
ctl.SetValue(Grid.RowProperty, row);
ctl.SetValue(Grid.ColumnProperty, col);
}
示例15: SetRegisterAsMediaService
/// <summary>
/// Sets value describing whether FrameworkElement is acting as View in MVVM.
/// </summary>
public static void SetRegisterAsMediaService(FrameworkElement target, bool value)
{
target.SetValue(RegisterAsMediaServiceProperty, value);
}