I need to simulate thru code the user clicking on a header of a WPF datagrid column (using .Net 4 in case it matters).
Is this possible?
I need to simulate thru code the user clicking on a header of a WPF datagrid column (using .Net 4 in case it matters).
Is this possible?
I think you can use the AutomationPeer classes, which are designed for this sort of thing, specifically the DataGridColumnHeaderItemAutomationPeer Class.
DataGridColumnHeaderItemAutomationPeer peer = new DataGridColumnHeaderItemAutomationPeer (Your_control);
IInvokeProvider invoker= (IInvokeProvider)peer;
invoker.Invoke(); // Invoke a click programmatically