-
-
Notifications
You must be signed in to change notification settings - Fork 777
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
Fix ListView to be compatible when ListView.View is a GridView #979
Fix ListView to be compatible when ListView.View is a GridView #979
Conversation
@@ -0,0 +1,60 @@ | |||
namespace Wpf.Ui.Controls; | |||
|
|||
public class ListView : System.Windows.Controls.ListView |
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.
|
||
public class ListView : System.Windows.Controls.ListView | ||
{ | ||
public string ViewState |
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.
Missing docs for pubplic property
Hey @koal44 , thanks for your contribution to the project. I would add some documentation and improve the formatting |
Removed the custom class ui:ListView as its purpose was to expose the ViewState, which can be simplified by directly binding to ListView.View with a ValueConverter.
29cb0d0
to
96d10c0
Compare
I force pushed the last commit so that it aligned better with Wpf.Ui/development. The latest commit removes the custom I didn't mention it before, but the XAML style for |
Any idea when this will be released? |
|
||
namespace Wpf.Ui.Controls; | ||
|
||
public enum ListViewViewState |
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.
Missing docs for public api
…4/wpfui into fix/gridview-compatibility
Ok, the recent update should address reviewer concerns about documentation and VS tooling. I also re-implemented the custom |
Looking forward to these ListView PRs showing up in a release! This is great, thank you! |
Hey, already released in the version 3.0.3 |
Tried setting the IsEnabled property to false? |
I'm trying out the latest version and its looking great! Thanks so much! |
The UI library currently breaks all
ListView
controls that use theGridView
view. This PR adds support forGridView
and showcases it in the GalleryAppPull request type
What is the current behavior?
The current behavior is that UI library interferes with how different derived types of
BaseView
are dynamically stylized, which renders types likeGridView
incompatible with this library. Although you can workaround this by voiding the library's styles, something like:Digging through older framework code, it appears that when
View
changes,ListView
uses the currentView
to change its ownDefaultStyleKey
and also apply new keys to its viewitem children. When theView
is null, theDefaultStyleKey
will point toListBox
andListBoxItem
(theme styles) and forGridView
it'll beGridViewStyle
andGridViewItemContainerStyle
. When this library directly set a style onListView
andListViewItem
it broke the unorthodox approach the framework used to dynamically set styles to different views.My first attempt was to go with the flow of the WPF framework. For example, you should be able to style
ListBox
and see that refelcted in aListView
with nullView
, but various attempts at this failed.Since there is actually only one derived type of BaseView - namely
GridView
, there are effectively only two scenarios that exist - nullview and gridview, so we can use a more standard approach and use xaml styles to handle these two different cases.What is the new behavior?
View
ListView.xaml
andListViewItem.xaml
to adapt to different View statesOther information