本文整理匯總了C#中Windows.UI.Xaml.FrameworkElement.GetProvider方法的典型用法代碼示例。如果您正苦於以下問題:C# FrameworkElement.GetProvider方法的具體用法?C# FrameworkElement.GetProvider怎麽用?C# FrameworkElement.GetProvider使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Windows.UI.Xaml.FrameworkElement
的用法示例。
在下文中一共展示了FrameworkElement.GetProvider方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: AutomationInvokeAction
private static object AutomationInvokeAction(FrameworkElement element)
{
var invokeProvider = element.GetProvider<IInvokeProvider>(PatternInterface.Invoke);
invokeProvider.Invoke();
return null;
}
示例2: AutomationScrollAction
private static object AutomationScrollAction(FrameworkElement element, IDictionary<string, JToken> parameters)
{
var scrollProvider = element.GetProvider<IScrollProvider>(PatternInterface.Scroll);
var scrollInfo = parameters["args"].ElementAtOrDefault(1);
if (scrollInfo == null)
{
var msg = string.Format(HelpArgumentsErrorMsg, HelpUrlAutomationScript);
throw new AutomationException(msg, ResponseStatus.JavaScriptError);
}
var horizontalAmount = ParseScrollAmount(scrollInfo["horizontal"] ?? scrollInfo["h"]);
var verticalAmount = ParseScrollAmount(scrollInfo["vertical"] ?? scrollInfo["v"]);
var count = (scrollInfo["count"] ?? 1).Value<int>();
if (horizontalAmount != ScrollAmount.NoAmount && !scrollProvider.HorizontallyScrollable)
{
throw new AutomationException("Element is not horizontally scrollable.", ResponseStatus.JavaScriptError);
}
if (verticalAmount != ScrollAmount.NoAmount && !scrollProvider.VerticallyScrollable)
{
throw new AutomationException("Element is not vertically scrollable.", ResponseStatus.JavaScriptError);
}
for (var i = 0; i < count; ++i)
{
scrollProvider.Scroll(horizontalAmount, verticalAmount);
}
return null;
}
示例3: TogglePatternToggleState
private static string TogglePatternToggleState(FrameworkElement element)
{
var provider = element.GetProvider<IToggleProvider>(PatternInterface.Toggle);
return provider.ToggleState.ToString();
}
示例4: TogglePatternToggle
private static object TogglePatternToggle(FrameworkElement element)
{
var provider = element.GetProvider<IToggleProvider>(PatternInterface.Toggle);
provider.Toggle();
return null;
}