-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add basic support for automation for DataGrid and DataGridRow #15174
Merged
wieslawsoltes
merged 5 commits into
AvaloniaUI:master
from
wieslawsoltes:automation/datagrid
Mar 30, 2024
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e60586a
Add basic support for automation for DataGrid and DataGridRow
wieslawsoltes c24e7bf
Add DataGridCellAutomationPeer
wieslawsoltes a16e6be
Add DataGridColumnHeaderAutomationPeer
wieslawsoltes 24a2615
Add DataGridColumnHeadersPresenterAutomationPeer
wieslawsoltes e5b5fc9
Add DataGridDetailsPresenterAutomationPeer
wieslawsoltes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
src/Avalonia.Controls.DataGrid/Automation/Peers/DataGridAutomationPeer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Avalonia.Automation.Peers; | ||
|
||
namespace Avalonia.Controls.Automation.Peers; | ||
|
||
public class DataGridAutomationPeer : ControlAutomationPeer | ||
{ | ||
public DataGridAutomationPeer(DataGrid owner) | ||
: base(owner) | ||
{ | ||
} | ||
|
||
public new DataGrid Owner => (DataGrid)base.Owner; | ||
|
||
protected override AutomationControlType GetAutomationControlTypeCore() | ||
{ | ||
return AutomationControlType.DataGrid; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/Avalonia.Controls.DataGrid/Automation/Peers/DataGridCellAutomationPeer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Avalonia.Automation.Peers; | ||
|
||
namespace Avalonia.Controls.Automation.Peers; | ||
|
||
public class DataGridCellAutomationPeer : ContentControlAutomationPeer | ||
{ | ||
public DataGridCellAutomationPeer(DataGridCell owner) | ||
: base(owner) | ||
{ | ||
} | ||
|
||
public new DataGridCell Owner => (DataGridCell)base.Owner; | ||
|
||
protected override AutomationControlType GetAutomationControlTypeCore() | ||
{ | ||
return AutomationControlType.Custom; | ||
} | ||
|
||
protected override bool IsContentElementCore() => true; | ||
|
||
protected override bool IsControlElementCore() => true; | ||
} |
22 changes: 22 additions & 0 deletions
22
src/Avalonia.Controls.DataGrid/Automation/Peers/DataGridColumnHeaderAutomationPeer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using Avalonia.Automation.Peers; | ||
|
||
namespace Avalonia.Controls.Automation.Peers; | ||
|
||
public class DataGridColumnHeaderAutomationPeer : ContentControlAutomationPeer | ||
{ | ||
public DataGridColumnHeaderAutomationPeer(DataGridColumnHeader owner) | ||
: base(owner) | ||
{ | ||
} | ||
|
||
public new DataGridColumnHeader Owner => (DataGridColumnHeader)base.Owner; | ||
|
||
protected override AutomationControlType GetAutomationControlTypeCore() | ||
{ | ||
return AutomationControlType.HeaderItem; | ||
} | ||
|
||
protected override bool IsContentElementCore() => false; | ||
|
||
protected override bool IsControlElementCore() => true; | ||
} |
23 changes: 23 additions & 0 deletions
23
...alonia.Controls.DataGrid/Automation/Peers/DataGridColumnHeadersPresenterAutomationPeer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using Avalonia.Automation.Peers; | ||
using Avalonia.Controls.Primitives; | ||
|
||
namespace Avalonia.Controls.Automation.Peers; | ||
|
||
public class DataGridColumnHeadersPresenterAutomationPeer : ControlAutomationPeer | ||
{ | ||
public DataGridColumnHeadersPresenterAutomationPeer(DataGridColumnHeadersPresenter owner) | ||
: base(owner) | ||
{ | ||
} | ||
|
||
public new DataGridColumnHeadersPresenter Owner => (DataGridColumnHeadersPresenter)base.Owner; | ||
|
||
protected override AutomationControlType GetAutomationControlTypeCore() | ||
{ | ||
return AutomationControlType.Header; | ||
} | ||
|
||
protected override bool IsContentElementCore() => false; | ||
|
||
protected override bool IsControlElementCore() => true; | ||
} |
14 changes: 14 additions & 0 deletions
14
src/Avalonia.Controls.DataGrid/Automation/Peers/DataGridDetailsPresenterAutomationPeer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using Avalonia.Automation.Peers; | ||
using Avalonia.Controls.Primitives; | ||
|
||
namespace Avalonia.Controls.Automation.Peers; | ||
|
||
public class DataGridDetailsPresenterAutomationPeer : ControlAutomationPeer | ||
{ | ||
public DataGridDetailsPresenterAutomationPeer(DataGridDetailsPresenter owner) | ||
: base(owner) | ||
{ | ||
} | ||
|
||
public new DataGridDetailsPresenter Owner => (DataGridDetailsPresenter)base.Owner; | ||
} |
20 changes: 20 additions & 0 deletions
20
src/Avalonia.Controls.DataGrid/Automation/Peers/DataGridRowAutomationPeer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using Avalonia.Controls; | ||
|
||
namespace Avalonia.Automation.Peers | ||
{ | ||
public class DataGridRowAutomationPeer : ControlAutomationPeer | ||
{ | ||
public DataGridRowAutomationPeer(DataGridRow owner) | ||
: base(owner) | ||
{ | ||
} | ||
|
||
protected override AutomationControlType GetAutomationControlTypeCore() | ||
{ | ||
return AutomationControlType.DataItem; | ||
} | ||
|
||
protected override bool IsContentElementCore() => true; | ||
protected override bool IsControlElementCore() => true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UWP implementation uses three state possible values here:
https://github.com/CommunityToolkit/WindowsCommunityToolkit/blob/main/Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/DataGrid/Automation/DataGridCellAutomationPeer.cs#L82-L98
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I guess it's not as necessary for starters, since basic text works either way.