/// <summary>
 /// Converts the element to a <see cref="Window"/>.
 /// </summary>
 public static Window AsWindow(this AutomationElement self)
 {
     return(self == null ? null : new Window(self.FrameworkAutomationElement));
 }
        /// <summary>
        /// Generic method to convert the element to the given type.
        /// </summary>
        public static T As <T>(this AutomationElement self) where T : AutomationElement
        {
            var type = typeof(T);

            return(self == null ? null : (T)Activator.CreateInstance(typeof(T), self.FrameworkAutomationElement));
        }
 /// <summary>
 /// Converts the element to a <see cref="TreeItem"/>.
 /// </summary>
 public static TreeItem AsTreeItem(this AutomationElement self)
 {
     return(self == null ? null : new TreeItem(self.FrameworkAutomationElement));
 }
 /// <summary>
 /// Converts the element to a <see cref="VerticalScrollBar"/>.
 /// </summary>
 public static VerticalScrollBar AsVerticalScrollBar(this AutomationElement self)
 {
     return(self == null ? null : new VerticalScrollBar(self.FrameworkAutomationElement));
 }
 /// <summary>
 /// Converts the element to a <see cref="GridCell"/>.
 /// </summary>
 public static GridCell AsGridCell(this AutomationElement self)
 {
     return(self == null ? null : new GridCell(self.FrameworkAutomationElement));
 }
 /// <summary>
 /// Converts the element to a <see cref="ListBoxItem"/>.
 /// </summary>
 public static ListBoxItem AsListBoxItem(this AutomationElement self)
 {
     return(self == null ? null : new ListBoxItem(self.FrameworkAutomationElement));
 }
 /// <summary>
 /// Converts the element to a <see cref="TextBox"/>.
 /// </summary>
 public static TextBox AsTextBox(this AutomationElement self)
 {
     return(self == null ? null : new TextBox(self.FrameworkAutomationElement));
 }
 /// <summary>
 /// Converts the element to a <see cref="DateTimePicker"/>.
 /// </summary>
 public static DateTimePicker AsDateTimePicker(this AutomationElement self)
 {
     return(self == null ? null : new DateTimePicker(self.FrameworkAutomationElement));
 }
 /// <summary>
 /// Converts the element to a <see cref="Spinner"/>.
 /// </summary>
 public static Spinner AsSpinner(this AutomationElement self)
 {
     return(self == null ? null : new Spinner(self.FrameworkAutomationElement));
 }
 /// <summary>
 /// Converts the element to a <see cref="Calendar"/>.
 /// </summary>
 public static Calendar AsCalendar(this AutomationElement self)
 {
     return(self == null ? null : new Calendar(self.FrameworkAutomationElement));
 }
 /// <summary>
 /// Converts the element to a <see cref="RadioButton"/>.
 /// </summary>
 public static RadioButton AsRadioButton(this AutomationElement self)
 {
     return(self == null ? null : new RadioButton(self.FrameworkAutomationElement));
 }
 /// <summary>
 /// Converts the element to a <see cref="ProgressBar"/>.
 /// </summary>
 public static ProgressBar AsProgressBar(this AutomationElement self)
 {
     return(self == null ? null : new ProgressBar(self.FrameworkAutomationElement));
 }
 /// <summary>
 /// Converts the element to a <see cref="Menu"/>.
 /// </summary>
 public static Menu AsMenu(this AutomationElement self)
 {
     return(self == null ? null : new Menu(self.FrameworkAutomationElement));
 }
 /// <summary>
 /// Converts the element to a <see cref="ComboBox"/>.
 /// </summary>
 public static ComboBox AsComboBox(this AutomationElement self)
 {
     return(self == null ? null : new ComboBox(self.FrameworkAutomationElement));
 }
 /// <summary>
 /// Converts the element to a <see cref="Thumb"/>.
 /// </summary>
 public static Thumb AsThumb(this AutomationElement self)
 {
     return(self == null ? null : new Thumb(self.FrameworkAutomationElement));
 }
 /// <summary>
 /// Converts the element to a <see cref="DataGridView"/>.
 /// </summary>
 public static DataGridView AsDataGridView(this AutomationElement self)
 {
     return(self == null ? null : new DataGridView(self.FrameworkAutomationElement));
 }
 /// <summary>
 /// Converts the element to a <see cref="TitleBar"/>.
 /// </summary>
 public static TitleBar AsTitleBar(this AutomationElement self)
 {
     return(self == null ? null : new TitleBar(self.FrameworkAutomationElement));
 }
 /// <summary>
 /// Converts the element to a <see cref="Label"/>.
 /// </summary>
 public static Label AsLabel(this AutomationElement self)
 {
     return(self == null ? null : new Label(self.FrameworkAutomationElement));
 }
 /// <summary>
 /// Converts the element to a <see cref="ToggleButton"/>.
 /// </summary>
 public static ToggleButton AsToggleButton(this AutomationElement self)
 {
     return(self == null ? null : new ToggleButton(self.FrameworkAutomationElement));
 }
 /// <summary>
 /// Converts the element to a <see cref="GridHeaderItem"/>.
 /// </summary>
 public static GridHeaderItem AsGridHeaderItem(this AutomationElement self)
 {
     return(self == null ? null : new GridHeaderItem(self.FrameworkAutomationElement));
 }
 /// <summary>
 /// Converts the element to a <see cref="HorizontalScrollBar"/>.
 /// </summary>
 public static HorizontalScrollBar AsHorizontalScrollBar(this AutomationElement self)
 {
     return(self == null ? null : new HorizontalScrollBar(self.FrameworkAutomationElement));
 }