Skip to content
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

Extensions and controls to the right namespace and more #1297

Conversation

edwinvandriel
Copy link
Contributor

Fixed issues from #983 (not all), #1140, #1175 for v2.0

  • Fix WrapPanel namespace
  • Unify extension classes under same namespace
  • Move the following to the Microsoft.Toolkit.Uwp.UI.Extensions namespace: SurfaceDialTextboxHelper, TextBoxMask, TextBoxRegex
  • ListViewBase split into partial
  • Extensions moved to separate directories for readability
  • Fixed samples affected by changes

@nmetulev
Copy link
Contributor

nmetulev commented Jul 7, 2017

ping @hermitdave

My 2c: Instead of completely changing the namespace and introducing a hard breaking change, we should keep the old classes in the existing namespace (but deprecated) and encouraging developers to change over to the new namespace. Basically, we have both

@skendrot
Copy link
Contributor

skendrot commented Jul 7, 2017

Introducing a second class should have happened in 1.5. for 2.0 make the breaking change.

@hermitdave
Copy link
Contributor

Yes we discussed this late in 1.5 cycle.. Only had a few hours to go

Copy link
Contributor

@hermitdave hermitdave left a comment

Choose a reason for hiding this comment

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

@edwinvandriel we discussed this around the time 1.5 was being released and agreed that we should leave the existing extensions as is.
So we need to do the following

  • Mark existing extension classes WebViewExtensions, ListViewBaseExtensions and HyperlinkExtensions as obsolete
  • Create a copy of existing classes and rename them to WebView, ListViewBase and Hyperlink with correct namespace. The new classes could be split into partial classes as you did.
  • I would suggest doing the same with WrapPanel. Leave existing one as is and mark it as obsolete
  • Create a new WrapPanel with correct namespace.
  • Mark existing SurfaceDialTextboxHelper, TextBoxMask, TextBoxRegex as obsolete
  • Create a new SurfaceDialTextbox, TextBoxMask and TextBoxRegex within extensions folder / namespace

@hermitdave
Copy link
Contributor

@edwinvandriel old WrapPanel could / should just inherit from the one in correct namespace. The old one however does be obsolete.

@edwinvandriel
Copy link
Contributor Author

@hermitdave VS keeps complaining when I do that. The namespace 'Microsoft.Toolkit.Uwp.UI.Controls' already contains a definition for 'WrapPanel' Microsoft.Toolkit.Uwp.UI.Controls.

In my last commit I changed all the other obsolete classes and make them inherit the right class or class in the right namespace.

@hermitdave
Copy link
Contributor

@edwinvandriel the old wrap panel was under controls.wrappanel namespace. new one under controls and old one should stay where it was under controls.wrappanel.

@edwinvandriel
Copy link
Contributor Author

@hermitdave yes I know but even when I do that VS starts complaining. I'll give it another try.

@hermitdave
Copy link
Contributor

let me try that locally

@hermitdave
Copy link
Contributor

@edwinvandriel okay leave it as is w.r.t WrapPanel

@edwinvandriel
Copy link
Contributor Author

@hermitdave change it back to the WrapPanel namespace?

@hermitdave
Copy link
Contributor

@edwinvandriel no it could be a breaking change

xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Extensions"
Copy link
Contributor

Choose a reason for hiding this comment

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

can we use xmlns:extensions please ?

@@ -1,7 +1,7 @@
<Page x:Class="Microsoft.Toolkit.Uwp.SampleApp.SamplePages.TextBoxMaskPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Extensions"
Copy link
Contributor

Choose a reason for hiding this comment

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

can we use xmlns:extensions please ?

@@ -1,7 +1,7 @@
<Page x:Class="Microsoft.Toolkit.Uwp.SampleApp.SamplePages.TextBoxMaskPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Extensions"
Copy link
Contributor

Choose a reason for hiding this comment

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

can we use xmlns:extensions please ?

@@ -2,7 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:common="using:Microsoft.Toolkit.Uwp.SampleApp.Common"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Extensions"
Copy link
Contributor

Choose a reason for hiding this comment

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

can we use xmlns:extensions please ?

@@ -2,7 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:common="using:Microsoft.Toolkit.Uwp.SampleApp.Common"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Extensions"
Copy link
Contributor

Choose a reason for hiding this comment

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

can we use xmlns:extensions please ?

@@ -57,7 +58,7 @@ public static string GetMask(DependencyObject obj)
/// </summary>
/// <param name="obj">TextBox Control</param>
/// <param name="value">Mask Value</param>
public static void SetMask(DependencyObject obj, string value)
public static void SetMask(TextBox obj, string value)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you change the sample to ensure that we have use both x:Bind and Binding.. I have a feeling TextBox is going to bust x:Bind

@@ -67,7 +68,7 @@ public static void SetMask(DependencyObject obj, string value)
/// </summary>
/// <param name="obj">TextBox control</param>
/// <returns>placeholder value</returns>
public static string GetPlaceHolder(DependencyObject obj)
public static string GetPlaceHolder(TextBox obj)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you change the sample to ensure that we have use both x:Bind and Binding.. I have a feeling TextBox is going to bust x:Bind

@@ -77,7 +78,7 @@ public static string GetPlaceHolder(DependencyObject obj)
/// </summary>
/// <param name="obj">TextBox Control</param>
/// <param name="value">placeholder Value</param>
public static void SetPlaceHolder(DependencyObject obj, string value)
public static void SetPlaceHolder(TextBox obj, string value)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you change the sample to ensure that we have use both x:Bind and Binding.. I have a feeling TextBox is going to bust x:Bind

@@ -87,7 +88,7 @@ public static void SetPlaceHolder(DependencyObject obj, string value)
/// </summary>
/// <param name="obj">TextBox control</param>
/// <returns>CustomMask value</returns>
public static string GetCustomMask(DependencyObject obj)
public static string GetCustomMask(TextBox obj)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you change the sample to ensure that we have use both x:Bind and Binding.. I have a feeling TextBox is going to bust x:Bind

@@ -97,7 +98,7 @@ public static string GetCustomMask(DependencyObject obj)
/// </summary>
/// <param name="obj">TextBox Control</param>
/// <param name="value">CustomMask Value</param>
public static void SetCustomMask(DependencyObject obj, string value)
public static void SetCustomMask(TextBox obj, string value)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you change the sample to ensure that we have use both x:Bind and Binding.. I have a feeling TextBox is going to bust x:Bind

@edwinvandriel
Copy link
Contributor Author

@hermitdave I've made the changes except the Sample for TextboxMask, I'll take a look at that later

@@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:wrapPanel="using:Microsoft.Toolkit.Uwp.UI.Controls.WrapPanel"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls.WrapPanel"
Copy link
Contributor

Choose a reason for hiding this comment

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

the namespace

@hermitdave
Copy link
Contributor

@edwinvandriel much appreciate the quick turnaround

@@ -195,14 +195,14 @@
"DocumentationUrl": "https://raw.githubusercontent.com/Microsoft/UWPCommunityToolkit/dev/docs/controls/TileControl.md"
},
{
"Name": "SurfaceDialTextboxHelper",
"Type": "SurfaceDialTextboxHelperPage",
"Name": "SurfaceDialTextbox",
Copy link
Contributor

Choose a reason for hiding this comment

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

Should these be moved under Helpers, or maybe even their own Extensions page in the sample app? ping @hermitdave

readme.md Outdated
@@ -110,7 +110,7 @@ Once you search you should see a list similar to the one below (versions may be
* [ViewExtensions](http://www.uwpcommunitytoolkit.com/en/master/helpers/ViewExtensions/)
* [VisualTreeExtensions](http://docs.uwpcommunitytoolkit.com/en/master/helpers/VisualTreeExtensions/)
* [WeakEventListener](http://docs.uwpcommunitytoolkit.com/en/master/helpers/WeakEventListener/)
* [WebViewExtensions](http://docs.uwpcommunitytoolkit.com/en/master/helpers/WebViewExtensions/)
* [WebView](http://docs.uwpcommunitytoolkit.com/en/master/helpers/WebView/)
Copy link
Contributor

Choose a reason for hiding this comment

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

In terms of documentation, should we still append Extensions (e.g. WebView Extensions). Or if we decide to move everything under an Extensions group, that would work as well.

@edwinvandriel
Copy link
Contributor Author

@nmetulev @hermitdave I think it would be better to create a new category Extensions in the sample app and documentation and shift some stuff over.

@hermitdave
Copy link
Contributor

Extensions group and everything under that.

@edwinvandriel
Copy link
Contributor Author

@nmetulev @hermitdave made a lot of changes and think this will be good for review :-)

Copy link
Contributor

@nmetulev nmetulev left a comment

Choose a reason for hiding this comment

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

Looks good to me

@hermitdave
Copy link
Contributor

@edwinvandriel why about x:Bind sample for textbox extensions?

@edwinvandriel
Copy link
Contributor Author

@hermitdave I've tested that and failed so I had to change the method parameter from TextBox to DependencyProperty. I do not understand why this happens.

@hermitdave
Copy link
Contributor

It's because of the auto generated code for x:Bind

@edwinvandriel
Copy link
Contributor Author

@hermitdave maybe it's better to keep the scope of this PR to put things in the right namespaces and I'll start another PR soon with changes to the samples where it's needed.

@Vijay-Nirmal Vijay-Nirmal mentioned this pull request Jul 30, 2017
23 tasks
@nmetulev
Copy link
Contributor

nmetulev commented Aug 6, 2017

@hermitdave, @edwinvandriel, up?

@hermitdave
Copy link
Contributor

@nmetulev sorry have been on holiday with bad connectivity :) let me double check

/// <summary>
/// Horizontal and Vertical stretch
/// </summary>
All
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be use Both instead of All ?
Following the usage in
https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.stretchdirection

Copy link
Contributor

Choose a reason for hiding this comment

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

It would be yet another breaking change, if we are ok with that? I'm all for having a consistent usage

@edwinvandriel
Copy link
Contributor Author

@nmetulev @hermitdave agree to change the enumeration from All to Both for consistency. I've pushed a commit with the change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants