-
Notifications
You must be signed in to change notification settings - Fork 705
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
Adding spec for Date/TimePicker design updates #4490
Conversation
@MikeHillberg @jevansaks - I just pushed updates based on the spec review. There's still one to-do about adding a reflection example using the WPF Visual Brush. Is that needed? |
I don't think a reflection example is really necessary. It's not in line with the intent of this API. |
|
What about something like RecolorOverlayPresenter |
Co-authored-by: Raymond Chen <[email protected]>
Thanks @oldnewthing - I've applied your suggestions and made more changes based on your feedback. @mdtauk - I think the discussion/reasoning for "monochromatic" over something with "color" was that it's not an all-purpose tool to replace colors. @jevansaks can fill in the details that I've missed there, though |
Right, it turns all colors in the SourceElement into one single color. Hence, monochrome. |
I think I get that, like Transparent = Red for instance. But it is essentially a recolouring of elements, or a Color Swapper - and is not restricted to a greyscale palette. I guess its more of a designer interpretation, rather than a technical one. Also, has there been any thought put to swapping background and foreground colours? The text colour would adapt to contrast with the background colour. |
I was trying to see if there was an industry term for this operation but I couldn't find it. It reminds me of a DirectX fixed function operation, but I can't think of what it would be in Photoshop.
I'm not sure what you mean? This primitive helps with that -- ReplacementColor is the foreground and the Background is the background. Are you thinking we could auto-magically determine the correct foreground and contrasting background color? |
Exactly. |
|
||
[MUX_PROPERTY_CHANGED_CALLBACK(TRUE)] | ||
[MUX_PROPERTY_CHANGED_CALLBACK_METHODNAME("OnPropertyChanged")] | ||
unsealed runtimeclass MonochromaticOverlayPresenter : Windows.UI.Xaml.Controls.FrameworkElement |
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.
we currently inherit from Grid for this class, as we use the Background and CornerRadius properties that don't exist in FrameworkElement or Panel (Background exists but CornerRadius doesn't)
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.
@MikeHillberg Are there other types that would be better to derive from? I think Control wouldn't work because Control only has the properties, it doesn't do the drawing.
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.
The implementation can derive from Grid, we just don't need/want the public API to have extra unnecessary members.
About the "monochrome" name, we had the same difficulty naming BitmapIcon.ShowAsMonochrome. According to the dictionary it's technically accurate to be a color other than black. |
Using a contrived example: Lets say you have a control that is styled using a light theme. However, you want a very specific geometric subsection (could be rectangular) to be rendered with the dark theme. Such a Such a generalized approach is not only more correct from a framework standpoint, it also ensures this is future proofed for further design direction. There are a lot of complexities with this idea though, and there would be some major restrictions that mean basically only color can be changed between the two styles (even changing a border thickness would cause misalignment and the inability to composite a usable final result). |
Perhaps. We went this direction primarily because for WinUI2, changing the XAML framework for things that we want to work downlevel isn't possible (yet). So we resort to creative hacks such as this. :) Once we have WinUI3 we can certainly discuss more holistic approaches. But even when we can, sometimes the creative targeted solution like this is still the best option because we have limited time to work on everything and a fully generalized solution isn't a great return on investment. In this case, where else would such a generalized solution be applicable? And, more importantly, in what ways would that solution handle things that this solution doesn't? |
Yea, that's certainly understood. As always, I also understand your resource constraints but still push for what seems best for the future of the framework itself. Nothing is more permanent than a temporary solution. That said, I don't think there are many concerns here as the
Think of this more as you just got me thinking of some brand-new ideas. I don't recall this scenario being considered before like this so it's new territory. With new territory I think the generalized solution should always be investigated. I'll have to keep thinking about this over time and other more powerful use cases might become apparent. Finally, the current |
For sure. The feature that came up in our API spec discussion is that this is very similar to the VisualBrush feature in WPF. What I think would be more generalized is a control that exposes the ability to do a VisualSurface of anything and then apply any composition effect brush to it. That's something which we could easily build without new framework functionality and could enable some cool effects. |
I may have misunderstood how this was being implemented then. Additionally, VisualBrushes to me are used more for repeating patterns (It would have been nice to have these for the color picker checkered backgrounds). So other than perhaps similar API patterns I'm not sure how this is similar to a VisualBrush. However:
Conceptually I was thinking the same as what you describe here -- allowing any effect to be applied to the underlying image -- like filters in graphics software. I guess my assumption was the operations to swap out and modify the colors were being done on the rendered bitmap. Seems not? I don't know enough about WinUI's underlying composition system but this still sounding like 'BitmapEffect' from WPF for the most part. You know a lot more about how this is working behind the scenes so I could easily be wrong here. Also note that a system to swap styles would still be more powerful and general purpose for this specific case (you could modify the background/foreground brushes as the same time in XAML and do it before things are rendered to a bitmap). However, this DatePicker design can also be achieved using a filter effect as you described. |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
🎉 Handy links: |
Replacing the PR here: microsoft/microsoft-ui-xaml-specs#114, moving this onto the main repo.