-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
feat(Expander): add ability to change expander orientation #1336
Conversation
Did you take a look a look at the LayoutTransformControl from the WinRT XAML Toolkit by @xyzzer? |
@skendrot Seems very similar. One interesting thing is that this control handle PropertyChange of Value of Transform component (like the change on Angle of RotateTransform). Should I add the dependency to this Library and use this control instead of the one I recreated? |
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.
Quick review. Will need to do a more detailed review later
/// <summary> | ||
/// Key of the VisualStateGroup that set orientation of the control | ||
/// </summary> | ||
public const string OrientationGroupStateContent = "OrientationStates"; |
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.
Why are these public?
|
||
namespace Microsoft.Toolkit.Uwp.UI.Controls | ||
{ | ||
public enum ExpanderOrientation |
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.
How about ExpandDirection
/// <summary> | ||
/// Top | ||
/// </summary> | ||
Top, |
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.
Let's use the same values as WPF
Down,
Up,
Left,
Right
// Can't tab to LayoutTransformer | ||
IsTabStop = false; | ||
|
||
#if SILVERLIGHT |
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'll never be Silverlight
return; | ||
} | ||
|
||
if (Orientation == ExpanderOrientation.Left) |
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.
change to a switch statement
} | ||
|
||
// Apply rotation on expander toggle button | ||
layoutTransformer.ApplyLayoutTransform(); |
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.
could be null if styled out
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.
I don't understand. Null is checked before using the method.
@@ -0,0 +1,537 @@ | |||
// ****************************************************************** | |||
// Copyright (c) Microsoft. All rights reserved. | |||
// This code is licensed under the MIT License (MIT). |
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.
Can we incorporate this code like this and re-license it as it's from the SO post?
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.
@hawkerm Good question. I checked and the code in blog post is originally from Silverlight XAML, so it is already the property of Microsoft. So, I suppose we can.
If the other LayoutTransformControl behaves in the same manner, I'd suggest to use it with the clearer license term compatibility. |
Does the header need to rotate? The WPF Expander never did |
The two options are possible IMO. But clearly, we should not reinvent the wheel and reuse the WinRTXamlToolkit. |
@skendrot I need to rotate because the Header content should rotate if you want the header text to rotate. If there was only the arrow icon, we should not need it. |
My question is why does that have to be the default? Why have it built in? If the dev wants the header text to rotate, they can pull in the WinRTXamlToolkit and restyle. I don't think this toolkit needs a LayoutTransform when an established toolkit already has it. |
@skendrot I now use the control from WinRTXAMLToolkit. It works exactly like before and I removed the LayoutTransform control from the UWP Toolkit. |
But should this toolkit have a dependency on WinRTXamlToolkit? |
@skendrot If I don't do it, it will not look pretty. If left or right oriented, the header will take too much space. I don't think that's what we want. |
Remember that more than text can go into the header. Could easily put text with images and other information into the header. You would not want this rotated. |
Because the Header contains the arrow, the arrow is also rotated thanks to the LayoutTransform. In my opinion, since the Header is on the side (reading it vertically and not horizontally), it feels "normal" to me that all the content is rotated, even if it is not only text. |
It does seem heavy to add a whole new dependency; not sure about copying it out for inclusion here, is that generally done? From a UX perspective, I think most people expect the text to be rotated in these cases (that's the default I've seen for other libraries). But if we're trying to be WPF compatible, then we probably want to leave the behavior the same. I think though if rotating is not the default and has to be done through restyling, it'd be good to have a sample that shows how to do that as it is a common usage. |
Yes. I agree that some sort of sample, either in the toolkit itself or via a blog post would help here. |
@xyzzer, any concerns with moving the LayoutTransformControl to the toolkit? |
Hi guys, sorry for ignoring this thread. Work's been busy and I've been ignoring emails from UWP Community Toolkit. I totally think you should use LayoutTransformControl if it's been shown to work. I haven't heard complaints. Can't recall where I took it from, but I might have simply ported the code from Silverlight Toolkit rather than writing my own version, so the quality should be great, right? :) Also - I recommend just copying the code, but this is a very subjective opinion. My opinion of WinRT XAML Toolkit itself has grown to be that people should totally use it for quickly sketching apps, prototypes, etc. and all the controls and helpers available at their fingertips, but as soon as you start working on an app you'd like to ship - you should strongly consider copying and pasting the code out of the toolkit to make sure you're not dragging along a few megabytes of dead code to download and load with your app. Yes, you'd lose the benefit of updates to the toolkit benefiting future builds of your app, but I don't actually update it that frequently anyways and so you're more likely to fix the bugs yourself if they're in your own source code. I considered breaking the toolkit apart more granularly so that every component would be its own NuGet package, but that turned out to be a very daunting task that I quickly dropped and so there are only a few NuGet packages with larger and more loosely related sets of components. For UWP Community Toolkit thus it would make sense to similarly - include a copy of the source, so that people can use it easily without dragging along hidden dependencies with different namespaces and also so that if they want to see how things work in that control - they only have to use at the UWP Community Toolkit source instead of spelunking a bunch of different GitHub repos. |
Great insight. I think we are all in agreement at this point, @Odonno, what do you think? |
@@ -16,6 +16,7 @@ | |||
using Windows.UI.Xaml.Controls; | |||
using Windows.UI.Xaml.Controls.Primitives; | |||
using Windows.UI.Xaml.Markup; | |||
using WinRTXamlToolkit.Controls; |
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.
Make sure to move it to a better namespace.
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.
Please update the namespaces from WRTXT to UWPCT
@nmetulev I'm fine with it. Like I said, both options are possible. I'll copy the code and import it in the Toolkit. |
Thanks!
…On Sat, Aug 12, 2017 at 3:56 AM, David Bottiau ***@***.***> wrote:
@nmetulev <https://github.com/nmetulev> @xyzzer
<https://github.com/xyzzer> Done.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1336 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABrAsK8fd1BvAcngitX2tfyGlZI0fZ5iks5sXYTSgaJpZM4OhDOc>
.
|
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.
Could you also update the docs for the Expander to include the new property and add documentation for the LayoutTransformControl?
{ | ||
/// <summary> | ||
/// Control that implements support for transformations as if applied by | ||
/// LayoutTransform (which does not exist in Silverlight). |
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.
Should the bit about Silverlight be removed?
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.
All comments about Silverlight? I can do it.
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.
Yeah, unless you believe those are relevant?
{ | ||
/// <summary> | ||
/// Control that implements support for transformations as if applied by | ||
/// LayoutTransform (which does not exist in Silverlight). |
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.
Same here
But those are accurate! ;)
FWIW, I think we should keep them to keep the code funny.
…On Thu, Aug 17, 2017 at 8:59 AM, Nikola Metulev ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In Microsoft.Toolkit.Uwp.UI.Controls/LayoutTransformControl/
LayoutTransformControl.Properties.cs
<#1336 (comment)>
:
> +// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
+// THE CODE OR THE USE OR OTHER DEALINGS IN THE CODE.
+// ******************************************************************
+
+using System.Collections.Generic;
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Controls;
+using Windows.UI.Xaml.Media;
+
+namespace Microsoft.Toolkit.Uwp.UI.Controls
+{
+ /// <summary>
+ /// Control that implements support for transformations as if applied by
+ /// LayoutTransform (which does not exist in Silverlight).
Yeah, unless you believe those are relevant?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1336 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABrAsB_alExJb58v3zUficqvEmnMIKn4ks5sZGN8gaJpZM4OhDOc>
.
|
Linked to #922 where @hawkerm requested Expander DIrection/Orientation.
Might also solve #923 because I needed to handle Expander Toggle Button orientation using a LayoutTransformer, the RenderTransform component does not render very well in this case. I reused the LayoutTransformer control from this blog post http://igrali.com/2012/09/17/layout-transform-in-windows-8-winrt-xaml/