<commit_before># UIA.Extensions

`UIA.Extensions` is a .NET library that assists in exposing window controls to [Automation](http://msdn.microsoft.com/en-us/library/ms747327.aspx).

## Supported Controls

`UIA.Extensions` support the following:

### Value Pattern
The [`ValuePattern`](http://msdn.microsoft.com/en-us/library/system.windows.automation.valuepattern.aspx) allows you to get an set the value of a control. Not all controls support this pattern out of the box. Here is an example of how you might use `UIA.Extensions` to expose a [`MonthCalendar`](http://msdn.microsoft.com/en-us/library/system.windows.forms.monthcalendar.aspx) control to automation:

```csharp
public MainForm
{
  InitializeComponent();
  
  monthCalendar.AsValueControl(
    () => monthCalendar.SelectionStart.ToString() /* getter */,
    x => monthCalendar.SetDate(DateTime.Parse(x)) /* setter */);
}
```

### Tables
The [`TablePattern`](http://msdn.microsoft.com/en-us/library/system.windows.automation.tablepattern.aspx) is one that is used by `ListView`, `ListBox` and other various controls. Sometimes, however, controls that visually appear to be tables to not behave like `TablePattern` controls to automation. The [`DataGridView`](http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.aspx) class is one of those. Here is an example of how do expose the `DataGridView` control to automation:

```csharp
public MainForm
{
  InitializeComponent();
  
  dataGridView.AsTable(); // yes, that's it
}
```

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Make sure you have tests
5. Make sure your tests pass
6. Push to the branch (`git push origin my-new-feature`)
7. Create new Pull Request<commit_msg>update README to reflect change to value provider<commit_after># UIA.Extensions

`UIA.Extensions` is a .NET library that assists in exposing window controls to [Automation](http://msdn.microsoft.com/en-us/library/ms747327.aspx).

## Supported Controls

`UIA.Extensions` support the following:

### Value Pattern
The [`ValuePattern`](http://msdn.microsoft.com/en-us/library/system.windows.automation.valuepattern.aspx) allows you to get an set the value of a control. Not all controls support this pattern out of the box. Here is an example of how you might use `UIA.Extensions` to expose a [`MonthCalendar`](http://msdn.microsoft.com/en-us/library/system.windows.forms.monthcalendar.aspx) control to automation:


#### `ValueMonthCalendar.cs`

```csharp
using System;
using System.Windows.Forms;
using UIA.Extensions.AutomationProviders;

namespace UIA.Extensions.TestApplication.Implementations
{
  public class ValueMonthCalendar : ValueControl
  {
    private readonly MonthCalendar _monthCalendar;

    public ValueMonthCalendar(MonthCalendar monthCalendar) : base(monthCalendar)
    {
      _monthCalendar = monthCalendar;
    }

    public override string Value
    {
      get { return _monthCalendar.SelectionStart.ToShortDateString(); }
      set { _monthCalendar.SetDate(DateTime.Parse(value)); }
    }
  }
}

```

#### `MainForm.cs`

```csharp
using UIA.Extensions;

namespace YourApp
{
  public partial class MainForm : Form
  {
    InitializeComponent();

    monthCalendar.AsValueControl(
        () => monthCalendar.SelectionStart.ToString() /* getter */,
        x => monthCalendar.SetDate(DateTime.Parse(x)) /* setter */);
  }
}
```

### Tables
The [`TablePattern`](http://msdn.microsoft.com/en-us/library/system.windows.automation.tablepattern.aspx) is one that is used by `ListView`, `ListBox` and other various controls. Sometimes, however, controls that visually appear to be tables to not behave like `TablePattern` controls to automation. The [`DataGridView`](http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.aspx) class is one of those. Here is an example of how do expose the `DataGridView` control to automation:

```csharp
using UIA.Extensions;

namespace YourApp
{
  public partial class MainForm : Form
  {
    InitializeComponent();

    dataGridView.AsTable(); // yes, that's it
  }
}
```

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Make sure you have tests
5. Make sure your tests pass
6. Push to the branch (`git push origin my-new-feature`)
7. Create new Pull Request
{'fraction_non_alphanumeric': 0.11557450628366248, 'fraction_numerical': 0.0058348294434470375, 'mean_word_length': 4.389359129383313, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3557509', 'n_tokens_mistral': 1346, 'n_tokens_neox': 1270, 'n_words': 418}