Skip to content

Feature/gridview-min-max-widths #982

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

Merged
merged 16 commits into from
Mar 24, 2024

Conversation

koal44
Copy link
Contributor

@koal44 koal44 commented Mar 1, 2024

Add MinWidth and MaxWidth support for GridView

Pull request type

  • Feature

Info

This feature is a branch off of PR #979. It adds min/max width support for GridView. It uses a fair bit of reflection to maintain support for dragging column headers.

  • Extends GridViewColumn to have dependency properties MaxWidth and MinWidth
  • Overrides ArrangeOverride() on GridViewHeaderRowPresenter (header row) and GridViewRowPresenter (data rows)
  • Update ListView and ListViewItem to use the extended classes
  • Update the GalleryApp to showcase min/max widths

A fair amount of reflection was needed to support columnheader dragging
@koal44 koal44 requested a review from pomianowski as a code owner March 1, 2024 01:28
@pomianowski pomianowski self-assigned this Mar 19, 2024

namespace Wpf.Ui.Controls;

public class GridViewColumn : System.Windows.Controls.GridViewColumn
Copy link
Member

Choose a reason for hiding this comment

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

Is the Controls/ListView directory the right place for these classes? Maybe Controls/GridView would be more appropriate

self.OnMinWidthChanged(e);
}

protected virtual void OnMinWidthChanged(DependencyPropertyChangedEventArgs e)
Copy link
Member

Choose a reason for hiding this comment

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

Missing docs for public api

@@ -0,0 +1,60 @@
namespace Wpf.Ui.Controls;

public class ListView : System.Windows.Controls.ListView
Copy link
Member

Choose a reason for hiding this comment

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

Missing docs for public control


namespace Wpf.Ui.Controls;

public class GridViewRowPresenter : System.Windows.Controls.GridViewRowPresenter
Copy link
Member

Choose a reason for hiding this comment

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

Missing docs for public control


namespace Wpf.Ui.Controls;

public class GridViewHeaderRowPresenter : System.Windows.Controls.GridViewHeaderRowPresenter
Copy link
Member

Choose a reason for hiding this comment

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

Missing docs for public control

@github-actions github-actions bot added controls Changes to the appearance or logic of custom controls. styles Topic is related to styles PR Pull request dotnet labels Mar 19, 2024
@github-actions github-actions bot added the gallery WPF UI Gallery label Mar 19, 2024
koal44 added 4 commits March 19, 2024 16:02
… _desiredWidth

It turns out that the base methods for GridViewRow presenters can handle all the logic if _desiredWidth is preemptively adjusted
style ListViewItem to a custom one
semove global styling of GridViewColumnHeader

In this way, a user using ListView will see the vanilla version and when using ui:ListiView, ui:GridView and ui:GridViewColumn - they will see the ui library version
@koal44
Copy link
Contributor Author

koal44 commented Mar 20, 2024

I've added documentation and separated GridView related components into a Controls/GridView folder.

The ArrangeOverride() methods on RowPresenter classes was simplified and there's only one reflected field now. Additionally XAML styling is only on Wpf.Ui custom controls, so this library won't interfere with how vanilla ListView operates. Instead, to use the Wpf.Ui library's ListView styles, one would need to use all the ui custom classes.

TODO: restyle GridViewColumnHeader.xaml to support column resizing (logic should already be baked into the control).

@koal44 koal44 closed this Mar 23, 2024
@koal44 koal44 reopened this Mar 23, 2024
koal44 added 2 commits March 23, 2024 13:24
- Logic for drag resizing was already baked into the GridViewHeaderRow so all that was needed was a suitable style that used template parts (PART_HeadGripper)
- Styling the indicator required reflection because wpf framework creates the separator control in code via internal OnPreApplyTemplate() and private AddIndicator() methods
@koal44
Copy link
Contributor Author

koal44 commented Mar 24, 2024

Added drag resizing support.

gridview-resizing

@pomianowski pomianowski merged commit b20717e into lepoco:development Mar 24, 2024
2 checks passed
@koal44 koal44 deleted the feature/gridview-min-max-widths branch March 24, 2024 21:34
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 30, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
controls Changes to the appearance or logic of custom controls. dotnet gallery WPF UI Gallery PR Pull request styles Topic is related to styles
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants