Skip to content
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

Added PointerPressed and PointerReleased events to DataGrid header #12595

Merged
merged 15 commits into from
Nov 2, 2023

Conversation

ctacke
Copy link
Contributor

@ctacke ctacke commented Aug 19, 2023

What does the pull request do?

Adds the ability to capture pointer/mouse events at the application for the DataGrid header.

What is the current behavior?

Currently mouse events trigger sorting when sort is enabled, but do nothing when sort is disabled

What is the updated/expected behavior with this PR?

An event handler can be attached to the pointer events on a header
Example:

var column = new DataGridTextColumn
{
    Header = c.Key,
    Binding = new Binding($"Column{i}")
};
column.HeaderPointerReleased += OnHeaderPointerReleased;
dataGrid.Columns.Add(column);
...
private void OnHeaderPointerReleased(object? sender, Avalonia.Input.PointerReleasedEventArgs e)
{
}

How was the solution implemented (if it's not obvious)?

It is obvious

Checklist

Breaking changes

No breaking changes

Obsoletions / Deprecations

No obsoletions

Fixed issues

No issue reported

@TomEdwardsEnscape
Copy link
Contributor

General observation: in WPF this (and much more) can be achieved with EventSetter in a style targeting column headers. I really miss this feature in Avalonia.

@ctacke
Copy link
Contributor Author

ctacke commented Aug 20, 2023

@microsoft-github-policy-service agree

@timunie
Copy link
Contributor

timunie commented Aug 21, 2023

General observation: in WPF this (and much more) can be achieved with EventSetter in a style targeting column headers. I really miss this feature in Avalonia.

@maxkatz6 do you think we may want to have a feature request for this? Would be a great addition imo.

@maxkatz6
Copy link
Member

@timunie yeah, it can be discussed

@maxkatz6 maxkatz6 enabled auto-merge September 24, 2023 02:48
auto-merge was automatically disabled October 2, 2023 22:59

Head branch was pushed to by a user without write access

@ctacke
Copy link
Contributor Author

ctacke commented Oct 23, 2023

@dotnet-policy-service agree

Copy link
Member

@maxkatz6 maxkatz6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@maxkatz6 maxkatz6 added this pull request to the merge queue Nov 2, 2023
Merged via the queue into AvaloniaUI:master with commit 53c646b Nov 2, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants