Skip to content

Commit

Permalink
fix!: Move PersonPicture to MUX namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
Youssef1313 committed Feb 16, 2023
1 parent 853671a commit f0db06b
Show file tree
Hide file tree
Showing 98 changed files with 163 additions and 150 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MUXControlsTestApp"
xmlns:controls="using:Microsoft.UI.Xaml.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
Expand Down Expand Up @@ -75,19 +76,19 @@
x:Name="ContactBtn"
AutomationProperties.Name="ContactBtn"
Content="Set Contact"
Margin="0,0,10,0"
Margin="0,0,10,0"
Click="ContactBtn_Click" />
<Button
x:Name="ContactImageBtn"
AutomationProperties.Name="ContactImageBtn"
Content="Set Contact (w/ Image)"
Margin="10,0,10,0"
Margin="10,0,10,0"
Click="ContactImageBtn_Click" />
<Button
x:Name="ClearContactBtn"
AutomationProperties.Name="ClearContactBtn"
Content="Clear Contact"
Margin="10,0,10,0"
Margin="10,0,10,0"
Click="ClearContactBtn_Click" />
</StackPanel>

Expand All @@ -97,13 +98,13 @@
x:Name="ImageBtn"
AutomationProperties.Name="ImageBtn"
Content="Set Image"
Margin="0,0,10,0"
Margin="0,0,10,0"
Click="ImageBtn_Click" />
<Button
x:Name="ClearImageBtn"
AutomationProperties.Name="ClearImageBtn"
Content="Clear Image"
Margin="10,0,10,0"
Margin="10,0,10,0"
Click="ClearImageBtn_Click" />
</StackPanel>

Expand Down Expand Up @@ -141,43 +142,43 @@
<StackPanel Grid.Column="1">
<TextBlock Text="Sample controls" Style="{ThemeResource StandardGroupHeader}"/>

<PersonPicture
<controls:PersonPicture
x:Name="TestPersonPicture"
AutomationProperties.Name="TestPersonPicture"
AutomationProperties.Name="TestPersonPicture"
SizeChanged="TestPersonPicture_SizeChanged"/>

<StackPanel Orientation="Horizontal">
<ListView x:Name="PeopleLV" AutomationProperties.Name="PeopleLV" Height="200" Margin="10">
<ListViewItem>
<PersonPicture x:Name="PersonPicture0" AutomationProperties.Name="PersonPicture0"
<controls:PersonPicture x:Name="PersonPicture0" AutomationProperties.Name="PersonPicture0"
BadgeNumber="1" BadgeGlyph="\uE765" Initials="JB" DisplayName="James Bond"/>
</ListViewItem>
<ListViewItem>
<PersonPicture x:Name="PersonPicture1" AutomationProperties.Name="PersonPicture1"
<controls:PersonPicture x:Name="PersonPicture1" AutomationProperties.Name="PersonPicture1"
BadgeNumber="2" BadgeGlyph="\uE766" Initials="AP" DisplayName="Austin Powers"/>
</ListViewItem>
<ListViewItem>
<PersonPicture x:Name="PersonPicture2" AutomationProperties.Name="PersonPicture2"
<controls:PersonPicture x:Name="PersonPicture2" AutomationProperties.Name="PersonPicture2"
BadgeNumber="3" BadgeGlyph="\uE767" Initials="SA" DisplayName="Steve Austin"/>
</ListViewItem>
<ListViewItem>
<PersonPicture x:Name="PersonPicture3" AutomationProperties.Name="PersonPicture3"
<controls:PersonPicture x:Name="PersonPicture3" AutomationProperties.Name="PersonPicture3"
BadgeNumber="4" BadgeGlyph="\uE768" Initials="SJ" DisplayName="Super Jaimie"/>
</ListViewItem>
<ListViewItem>
<PersonPicture x:Name="PersonPicture4" AutomationProperties.Name="PersonPicture4"
<controls:PersonPicture x:Name="PersonPicture4" AutomationProperties.Name="PersonPicture4"
BadgeNumber="5" BadgeGlyph="\uE769" Initials="BB" DisplayName="Bruce Banner"/>
</ListViewItem>
<ListViewItem>
<PersonPicture x:Name="PersonPicture5" AutomationProperties.Name="PersonPicture5"
<controls:PersonPicture x:Name="PersonPicture5" AutomationProperties.Name="PersonPicture5"
BadgeNumber="6" BadgeGlyph="\uE770" Initials="BW" DisplayName="Bruce Wayne"/>
</ListViewItem>
</ListView>

<ListView x:Name="PeopleGLV" AutomationProperties.Name="PeopleGLV" Height="250" Margin="10" ItemsSource="{Binding Source={StaticResource cvs}}">
<ListView.ItemTemplate>
<DataTemplate>
<PersonPicture BadgeNumber="{Binding BadgeNumber}" Initials="{Binding Initials}" DisplayName="{Binding DisplayName}"/>
<controls:PersonPicture BadgeNumber="{Binding BadgeNumber}" Initials="{Binding Initials}" DisplayName="{Binding DisplayName}"/>
</DataTemplate>
</ListView.ItemTemplate>
<ListView.GroupStyle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
using Microsoft.VisualStudio.TestTools.UnitTesting.Logging;
#endif

using PersonPicture = Windows.UI.Xaml.Controls.PersonPicture;
using PersonPicture = Microsoft.UI.Xaml.Controls.PersonPicture;

namespace Windows.UI.Xaml.Tests.MUXControls.ApiTests
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ public partial class PersonPictureAutomationPeer : global::Windows.UI.Xaml.Auto
{
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public PersonPictureAutomationPeer( global::Windows.UI.Xaml.Controls.PersonPicture owner) : base(owner)
/* Manually adjusted parameter type. Otherwise, we get obsoletion warning. */
/* TODO: Adjust sync generator to always generate this with MUXC instead of WUXC */
public PersonPictureAutomationPeer( global::Microsoft.UI.Xaml.Controls.PersonPicture owner) : base(owner)
{
global::Windows.Foundation.Metadata.ApiInformation.TryRaiseNotImplemented("Windows.UI.Xaml.Automation.Peers.PersonPictureAutomationPeer", "PersonPictureAutomationPeer.PersonPictureAutomationPeer(PersonPicture owner)");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@
using Windows.ApplicationModel.Resources;
using Windows.Foundation;
using Windows.Storage.Streams;
using Windows.UI.Xaml.Automation;
using Windows.UI.Xaml.Automation.Peers;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Media.Imaging;
using Windows.UI.Xaml.Shapes;
using Microsoft.UI.Xaml.Automation;
using Microsoft.UI.Xaml.Automation.Peers;
using Microsoft.UI.Xaml.Media;

namespace Windows.UI.Xaml.Controls
namespace Microsoft.UI.Xaml.Controls
{
/// <summary>
/// Value indicating the general character set for a given character.
Expand Down Expand Up @@ -134,7 +132,7 @@ public static string InitialsFromDisplayName(string contactDisplayName)
else if (words.Length > 1)
{
// If there's at least two words, we'll show two initials.
//
//
// NOTE: Based on current implementation, we could be showing punctuation.
// For example, "John -Smith" would be "J-".
string firstWord = words.First();
Expand Down Expand Up @@ -294,7 +292,7 @@ static CharacterType GetCharacterType(string str)
}
break;
default:
// Preserve result's current state (if we never got data other
// Preserve result's current state (if we never got data other
// than "Other", it'll be set to other anyway).
break;
}
Expand Down Expand Up @@ -436,7 +434,7 @@ static CharacterType GetCharacterType(char character)
return CharacterType.Symbolic;
}

// CJK Unified Ideographs Extension
// CJK Unified Ideographs Extension
if ((character >= 0x3400) && (character <= 0x4DBF))
{
return CharacterType.Symbolic;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,19 @@
#pragma warning disable 108 // new keyword hiding
#pragma warning disable 114 // new keyword hiding
using Windows.System.UserProfile;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media;
using Windows.ApplicationModel.Contacts;
using System;

namespace Windows.UI.Xaml.Controls
namespace Microsoft.UI.Xaml.Controls
{
public partial class PersonPicture : Control
{
public ImageSource ProfilePicture
{
get => (Media.ImageSource)GetValue(ProfilePictureProperty);
get => (ImageSource)GetValue(ProfilePictureProperty);
set => SetValue(ProfilePictureProperty, value);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@
using Windows.ApplicationModel.Resources;
using Windows.Foundation;
using Windows.Storage.Streams;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Automation;
using Windows.UI.Xaml.Automation.Peers;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Media.Imaging;
using Windows.UI.Xaml.Shapes;

namespace Windows.UI.Xaml.Controls
namespace Microsoft.UI.Xaml.Controls
{
public partial class PersonPicture : Controls.Control
public partial class PersonPicture : Control
{
/// <summary>
/// XAML Element for the first TextBlock matching x:Name of InitialsTextBlock.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using Windows.UI.Xaml;
using Windows.UI.Xaml.Media;

namespace Windows.UI.Xaml.Controls
namespace Microsoft.UI.Xaml.Controls
{
public partial class PersonPictureTemplateSettings : DependencyObject
{
Expand Down
16 changes: 16 additions & 0 deletions src/Uno.UI/UI/Xaml/Controls/Unsupported/PersonPicture.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using System;

namespace Windows.UI.Xaml.Controls;

[Obsolete(
"The Windows.UI.Xaml.Controls version of this control is not supported. " +
"Please use Microsoft.UI.Xaml.Controls.PersonPicture instead.")]
public partial class PersonPicture
{
public PersonPicture()
{
throw new NotImplementedException(
"The Windows.UI.Xaml.Controls version of this control is not supported. " +
"Please use Microsoft.UI.Xaml.Controls.PersonPicture instead.");
}
}
Loading

0 comments on commit f0db06b

Please sign in to comment.