本文整理汇总了C#中System.Windows.UIElement.VerifyAccess方法的典型用法代码示例。如果您正苦于以下问题:C# UIElement.VerifyAccess方法的具体用法?C# UIElement.VerifyAccess怎么用?C# UIElement.VerifyAccess使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.UIElement
的用法示例。
在下文中一共展示了UIElement.VerifyAccess方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddManipulationDevice
/// <summary>
/// Returns a ManipulationDevice associated with the given UIElement.
/// </summary>
/// <param name="element">The target of the ManipulationDevice.</param>
/// <returns>
/// A ManipulationDevice associated with the element.
/// If a device already exists for the element, a reference to that instance
/// will be returned, otherwise a new instance will be created.
/// </returns>
/// <remarks>
/// This function is thread-safe but should be called only on the
/// same thread that 'element' is bound to, due to possibly calling
/// the ManipulationDevice constructor.
/// </remarks>
internal static ManipulationDevice AddManipulationDevice(UIElement element)
{
Debug.Assert(element != null, "element should be non-null.");
element.VerifyAccess();
ManipulationDevice device = GetManipulationDevice(element);
if (device == null)
{
if (_manipulationDevices == null)
{
_manipulationDevices = new Dictionary<UIElement, ManipulationDevice>(2);
}
device = new ManipulationDevice(element);
_manipulationDevices[element] = device;
}
return device;
}