-
Notifications
You must be signed in to change notification settings - Fork 79
Fix SettingsExpander ItemsSource scenario #290
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
Conversation
| element.ReadLocalValue(FrameworkElement.StyleProperty) == DependencyProperty.UnsetValue) | ||
| { | ||
| // TODO: Get item from args.Index? | ||
| element.Style = ItemContainerStyleSelector.SelectStyle(null, element); |
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.
Wonder if DataContext is set already here, should check, as that'd be just easier?
|
Random build failure again: Some of this was going to be resolved by the work I was trying to do on warnings for the long path of #211 as well. We could also see if the latest version is better? https://www.nuget.org/packages/Microsoft.Net.Native.Compiler/2.2.12-rel-31116-00 - @Sergio0694 what controls that, do you know? |
|
@michael-hawker So the jumping issue was gone when I removed the ScrollViewer in the Expander samples. The ToolkitSampleRenderer already has a ScrollViewer for these situations: But it's not there when using a ScrollViewer on main - so there might be some issue still. Will check if I can find that :) Overall, I think we need to re-XAML the sample renderer layout to avoid this quirks and think about how we want to deal with an overrideable MaxHeight and all that! |
|
@michael-hawker The .NET Native toolchain is a transitive dependency from Microsoft.NETCore.UniversalWindowsPlatform. You'll want to update to the latest and also ensure you're using the 64 bit binder. For that, set |
|
Using ItemsRepeater blocked by this WinUI issue: microsoft/microsoft-ui-xaml#3842 |
30429ae to
c3fc324
Compare
… a complete SettingsPage example.
…lays issue with current implementation)
… instead of ItemsControl This is the WinUI approach TabView/NavigationView uses and allows us to specify the entire Container in the DataTemplate. This is needed for the ItemSource scenario of SettingsExpander to work properly. We could also inherit from ContentControl instead of Control like NavigationView, but this was a simpler first step. Some ItemsControl properties/methods are still missing, but initial approach seems to work and resolve issues with our same desired API surface. New issue: Expander is shifting position when expanding for some reason now? (don't think it did that before)
Unsure if intended behavior, but seems like should file a WinUI issue. Think this isn't going to work well when the window gets resized and how we handle that vs. layout cycle...
ItemsRepeater doesn't respect HorizontalAlignment and tries to stretch to take all available space, see: microsoft/microsoft-ui-xaml#3842
…ntrol We can do everything back in the base implementation inherting from ItemsControl now that we understand what to do.
c3fc324 to
73c3675
Compare
niels9001
left a comment
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.
Tested, jumping is gone :). Great work!

Tied to Experiment #129 #216
Switch SettingsExpander to use ItemsRepeater and inherit from Control instead of ItemsControl
This is the WinUI approach TabView/NavigationView uses and allows us to specify the entire Container in the DataTemplate:
This is needed for the ItemSource scenario of SettingsExpander to work properly. Otherwise ItemsControl only sees the data item and sticks the container in another container, like this:
With this change the desired behavior works properly now:
This PR also split out the samples for more delineation in the future and room for a full complete settings page sample.
Notes:
We could also inherit from ContentControl instead of Control like NavigationView, but this was a simpler first step.
Some ItemsControl properties/methods are still missing, but initial approach seems to work and resolve issues with our same desired API surface.
New issue: Expander is shifting position when expanding for some reason now? (don't think it did that before)