http://msdn.microsoft.com/ko-kr/library/ms590934.aspx
ToggleButton
CheckBox
=>
AutomationPeer _apeer;
IToggleProvider chkBoxToggleProvider;
_apeer = new ToggleButtonAutomationPeer(obj as dynamic);
chkBoxToggleProvider = (IToggleProvider)_apeer;
chkBoxToggleProvider.Toggle();
Button
=>
IInvokeProvider invokeProv = null;
ButtonAutomationPeer peer = new ButtonAutomationPeer(obj as dynamic);
invokeProv = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider;
invokeProv.Invoke();
TextBox
=>
IInvokeProvider invokeProv = null;
TextBoxAutomationPeer peer = new TextBoxAutomationPeer(obj as dynamic);
peer.RaiseAutomationEvent(AutomationEvents.TextPatternOnTextChanged);
invokeProv = peer.GetPattern(PatternInterface.Invoke) as IInvokeProvider;
invokeProv.Invoke();
/// <param name="obj">크로스스레드방지</param>
/// <param name="obj">컨트롤</param>
/// <param name="routedEvent">라우트이벤트</param>
/// <param name="key">먹이는키</param>
/// <remarks>
/// ex) ControlAutomationPeer(this, HTextBox, UIElement.KeyUpEvent , Key.Enter);
/// </remarks>
public static void ControlAutomationPeer(DependencyObject dis, DependencyObject obj, RoutedEvent routedEvent, Key key)
{
dis.Dispatcher.BeginInvoke(DispatcherPriority.Send, (ThreadStart)delegate
{
KeyEventArgs keyEventArgs = new KeyEventArgs(Keyboard.PrimaryDevice, Keyboard.PrimaryDevice.ActiveSource, System.Environment.ProcessorCount, key);
keyEventArgs.RoutedEvent = routedEvent;//UIElement.KeyUpEvent;
(obj as dynamic).RaiseEvent(keyEventArgs);
//InputManager.Current.ProcessInput(eventArgs);
});
}