Skip to content

Implement Task Property for ListViewGroup - #3293

Merged
RussKie merged 1 commit into
dotnet:masterfrom
lonitra:task-property
Jun 3, 2020
Merged

RussKie merged 1 commit into
dotnet:masterfrom
lonitra:task-property

Conversation

@lonitra

@lonitra lonitra commented May 15, 2020 •

Copy link
Copy Markdown
Member

Fixes #2656

Proposed changes

  • Add Task API to ListViewGroup
  • Add GroupLinkClick event handler/args in ListView

Customer Impact

  • Customers will be able to add tasks to their ListViewGroups
  • Customers will receive callback to do as they please once group task clicked

Regression?

  • No

Screenshots

Before

image

After

grouptaskex1

Test methodology

  • Manual testing
  • Unit testing

TODOs:

  • Both narrator and inspect do not pick up on Task property, we'll need to do accessibility improvements here.
Microsoft Reviewers: Open in CodeFlow

@lonitra
lonitra requested a review from a team as a code owner May 15, 2020 20:21
@ghost ghost assigned lonitra May 15, 2020

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: newline

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: name.

Also, should we follow the Events[s_*] pattern. This would allocate IntPtr.Size more for each ListView ever

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We have events wired in two different manners.. @JeremyKuhne @Tanya-Solyanik any thoughts on which manner is preferred?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I can see that EventHandlerList is clearing out the delegates on disposal, which we need, it also does not take space for the event handler(only it's key object) unless one is defined by the developer. And ListView already uses it, so the new event should be added to that collection to make code more consistent and thus more maintainable.

We have events wired in two different manners.

What other way to add events to components do you mean?

hughbe
hughbe previously approved these changes May 15, 2020
@RussKie

This comment has been minimized.

@Tanya-Solyanik Tanya-Solyanik left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good, the main comment is Hugh's about using the Events collection and about sharing EventArgs among all group events.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I can see that EventHandlerList is clearing out the delegates on disposal, which we need, it also does not take space for the event handler(only it's key object) unless one is defined by the developer. And ListView already uses it, so the new event should be added to that collection to make code more consistent and thus more maintainable.

We have events wired in two different manners.

What other way to add events to components do you mean?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For this particular use case test data does not have to be an object array, it could be an array of strongly typed tuples with named parameters.
new (string Value, string Expected)[]
{
("a", "b"),
....
}
Then you access it as data.Value and data.Expected and don't cast.

@Tanya-Solyanik

Tanya-Solyanik commented May 21, 2020 •

Copy link
Copy Markdown
Contributor
public class ListViewGroupTask

This proposal makes sense, I really like the URL string property - it is much easier to type in a string in the UITypeEditor than to add an event handler. Also the task UI looks like a link, it's reasonable for it to support common link APIs.
The only drawback is that it will require the UITypeEditor.

@hughbe

hughbe commented May 21, 2020

Copy link
Copy Markdown
Contributor

So i'm not sure how much comctl32 actually exposes. It seems like internally the links (tasks) on the group are SysLink controls: https://docs.microsoft.com/en-us/windows/win32/controls/syslink-overview

SysLink has a bunch of features that don't appear to be exposed on ListViewGroup. It seems like the only API exposed by LVGROUPW is to set the task's name and not, for example, the URL.

There may be some ways to do this by enumerating through child windows of the LVGROUPW and finding the SysLink control.

@RussKie

RussKie commented May 21, 2020

Copy link
Copy Markdown
Contributor

After a team discussion, we settled on the following:

public class ListViewGroup
{
	public string TaskLink { get; set; }
}

@RussKie RussKie added the waiting-author-feedback The team requires more information from the author label May 26, 2020
@ghost ghost removed the waiting-author-feedback The team requires more information from the author label May 26, 2020

@RussKie RussKie left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍 with few docs-related issues

@ghost ghost added the waiting-author-feedback The team requires more information from the author label May 27, 2020
@ghost ghost removed the waiting-author-feedback The team requires more information from the author label May 28, 2020
@lonitra
lonitra force-pushed the task-property branch 5 times, most recently from fc4cdfd to d6646cd Compare May 28, 2020 05:32
RussKie
RussKie previously approved these changes Jun 1, 2020
@RussKie

RussKie commented Jun 1, 2020

Copy link
Copy Markdown
Contributor

Please rebase and resolve the merge conflict

@RussKie RussKie added the waiting-author-feedback The team requires more information from the author label Jun 2, 2020
@ghost ghost removed the waiting-author-feedback The team requires more information from the author label Jun 2, 2020
@dotnet dotnet deleted a comment from codecov Bot Jun 3, 2020
@dotnet dotnet deleted a comment from codecov Bot Jun 3, 2020
@dotnet dotnet deleted a comment from codecov Bot Jun 3, 2020
@RussKie RussKie added the waiting-author-feedback The team requires more information from the author label Jun 3, 2020

@RussKie RussKie left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good 👍

@ghost ghost removed the waiting-author-feedback The team requires more information from the author label Jun 3, 2020
Fixes dotnet#2656

ListViewGroup originally did not have support for task.
These changes adds a new property to ListViewGroup that
reflects the task displayed in the group header. These changes
also raises an event when the task is clicked.
[Flags]
public enum LIF : uint
{
ITEMINDEX = 0x00000001,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: for flags it's good to align the values:

   ITEMINDEX = 0x00000001,
   STATE     = 0x00000002,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

VS eats the space, that's how all of our definitions are :(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You have to undo the auto-format (which ends up as a separate commit, so you can just CTRL-Z after it formats). Yes, it bites that we have to fight VS, but you can align them. It is a pain to validate bit flags when they aren't lined up. Don't need to block on this.


In reply to: 434908242 [](ancestors = 434908242)

@JeremyKuhne JeremyKuhne left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

:shipit:

@RussKie
RussKie merged commit 5c741dc into dotnet:master Jun 3, 2020
@ghost ghost added this to the 5.0 Preview7 milestone Jun 3, 2020
@lonitra
lonitra deleted the task-property branch June 4, 2020 17:36
@ghost ghost locked as resolved and limited conversation to collaborators Feb 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for tasks to ListViewGroup

5 participants