-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bring back XAML2006/2009 XmlnsDefinition attributes (#878)
* Fix yaml triggers * Run pr's for release branches * Automated dotnet-format update (#839) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * [Housekeeping] Add provisionating xcode to net6 (#836) * Add provisionating xcode to net6 * Fix essentials device tests * try again * Update dependencies from https://github.com/xamarin/xamarin-android build main-a2156d41275b92de3cf23f7c79801327c74b7fe0-1 (#846) Microsoft.Android.Sdk.Windows From Version 11.0.200-ci.main.226 -> To Version 11.0.200-ci.main.234 Dependency coherency updates Microsoft.Dotnet.Sdk.Internal From Version 6.0.100-preview.4.21215.1 -> To Version 6.0.100-preview.4.21221.10 (parent: Microsoft.Android.Sdk.Windows Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> * WinUI Navigation Handler (#801) * WinUI Navigation Handler * - PR comments * - consolidate a few more APIs * - fix namespaces * - fix namespaces * Update src/Compatibility/Core/src/WinUI/FlyoutPageRenderer.cs Co-authored-by: Matthew Leibowitz <mattleibow@live.com> Co-authored-by: Matthew Leibowitz <mattleibow@live.com> * Improve Hot Reload Integration (#851) * Fixes HotReload (#853) Reverts changed from: 7d4d1ce#diff-2b4bb95e12307423f7126d91b43a1511b68d00535e9f2b5f535af85d7a388333R36 * Android Push/Pop Navigation (#837) * Android Navigation * - fix layout * - changes * - yay pushing * - wire up nav to use bundle ids * - cleanup * - setup pop * - build up nav stack * - remove nav push * - remove graph xml * Update global.json * - add android to non net6 controls project * - fix namespace * Update Microsoft.Maui-net6.sln * iOS NavigationPageHandler (#852) * iOS Navigation * - wire up iOS Navigation * - remove VET * - rework with HR * - fix namespace * - fix HR * - fix hr * - fix SO exception * - maybe? * - nullabel fix * Update dependencies from https://github.com/xamarin/xamarin-macios build 20210426.5 (#847) Microsoft.MacCatalyst.Sdk , Microsoft.iOS.Sdk From Version 14.5.100-ci.main.620 -> To Version 14.5.100-ci.main.658 Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: Rui Marinho <me@ruimarinho.net> * Automated dotnet-format update (#854) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Implement PickerHandler in WinUI (#779) * Implement PickerHandler in WinUI * Enab le nullable in some classes * Fix build error * Register MauiComboBox ResourceDictionary * Updated PickerExtensions * Updated MauiComboBox Co-authored-by: Rachel Kang <rachelkang@microsoft.com> * [Build] Update maestro with macOS and tvOS (#862) * [Build] Update maestro with macOS and tvOS * [Build] Add tvOS and macOS to workload/dogfood * Add Microsoft.iOS.Windows.Sdk Co-authored-by: Jonathan Peppers <jonathan.peppers@microsoft.com> * Update README.md (#865) * ContainerViewControllers should use the correct background color. (#868) Also set the title of the VC from a page * Automated dotnet-format update (#872) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Bring back XAML2006/2009 XmlnsDefinition attributes These are required so that things like x:Static can be resolved to Microsoft.Maui.Controls.Xaml.StaticExtension. Co-authored-by: Rui Marinho <me@ruimarinho.net> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: Shane Neuville <shneuvil@microsoft.com> Co-authored-by: Matthew Leibowitz <mattleibow@live.com> Co-authored-by: James Clancey <james.clancey@gmail.com> Co-authored-by: Javier Suárez <javiersuarezruiz@hotmail.com> Co-authored-by: Rachel Kang <rachelkang@microsoft.com> Co-authored-by: Jonathan Peppers <jonathan.peppers@microsoft.com> Co-authored-by: 1d0n7kn0w <3910210+1d0n7kn0w@users.noreply.github.com> Co-authored-by: Jonathan Dick <jodick@microsoft.com>
- Loading branch information
1 parent
10e2ec5
commit 4f8ee0f
Showing
16 changed files
with
484 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -337,4 +337,4 @@ void AddTextResizeDemo(Microsoft.Maui.ILayout layout) | |
layout.Add(explicitWidthTestLabel); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,4 +33,4 @@ private static void ConfigureNativeServices(HostBuilderContext arg1, IServiceCol | |
#endif | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,74 @@ | ||
using System; | ||
using Microsoft.UI.Xaml.Controls; | ||
#nullable enable | ||
using WBrush = Microsoft.UI.Xaml.Media.Brush; | ||
using WSelectionChangedEventArgs = Microsoft.UI.Xaml.Controls.SelectionChangedEventArgs; | ||
|
||
namespace Microsoft.Maui.Handlers | ||
{ | ||
public partial class PickerHandler : ViewHandler<IPicker, ComboBox> | ||
public partial class PickerHandler : ViewHandler<IPicker, MauiComboBox> | ||
{ | ||
protected override ComboBox CreateNativeView() => new ComboBox(); | ||
WBrush? _defaultForeground; | ||
|
||
[MissingMapper] | ||
public static void MapTitle(PickerHandler handler, IPicker view) { } | ||
protected override MauiComboBox CreateNativeView() | ||
{ | ||
var nativePicker = new MauiComboBox(); | ||
|
||
if (VirtualView != null) | ||
nativePicker.ItemsSource = ((LockableObservableListWrapper)VirtualView.Items)._list; | ||
|
||
return nativePicker; | ||
} | ||
|
||
[MissingMapper] | ||
public static void MapSelectedIndex(PickerHandler handler, IPicker view) { } | ||
protected override void ConnectHandler(MauiComboBox nativeView) | ||
{ | ||
nativeView.SelectionChanged += OnControlSelectionChanged; | ||
} | ||
|
||
[MissingMapper] | ||
public static void MapCharacterSpacing(PickerHandler handler, IPicker view) { } | ||
protected override void DisconnectHandler(MauiComboBox nativeView) | ||
{ | ||
nativeView.SelectionChanged -= OnControlSelectionChanged; | ||
} | ||
|
||
[MissingMapper] | ||
public static void MapFont(PickerHandler handler, IPicker view) { } | ||
protected override void SetupDefaults(MauiComboBox nativeView) | ||
{ | ||
_defaultForeground = nativeView.Foreground; | ||
|
||
[MissingMapper] | ||
public static void MapTextColor(PickerHandler handler, IPicker view) { } | ||
base.SetupDefaults(nativeView); | ||
} | ||
|
||
public static void MapTitle(PickerHandler handler, IPicker picker) | ||
{ | ||
handler.NativeView?.UpdateTitle(picker); | ||
} | ||
|
||
public static void MapSelectedIndex(PickerHandler handler, IPicker picker) | ||
{ | ||
handler.NativeView?.UpdateSelectedIndex(picker); | ||
} | ||
|
||
public static void MapCharacterSpacing(PickerHandler handler, IPicker picker) | ||
{ | ||
handler.NativeView?.UpdateCharacterSpacing(picker); | ||
} | ||
|
||
public static void MapFont(PickerHandler handler, IPicker picker) | ||
{ | ||
var fontManager = handler.GetRequiredService<IFontManager>(); | ||
|
||
handler.NativeView?.UpdateFont(picker, fontManager); | ||
} | ||
|
||
public static void MapTextColor(PickerHandler handler, IPicker picker) | ||
{ | ||
handler.NativeView?.UpdateTextColor(picker, handler._defaultForeground); | ||
} | ||
|
||
[MissingMapper] | ||
public static void MapHorizontalTextAlignment(PickerHandler handler, IPicker view) { } | ||
|
||
void OnControlSelectionChanged(object? sender, WSelectionChangedEventArgs e) | ||
{ | ||
if (VirtualView != null && NativeView != null) | ||
VirtualView.SelectedIndex = NativeView.SelectedIndex; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System; | ||
using Microsoft.UI; | ||
using WBrush = Microsoft.UI.Xaml.Media.Brush; | ||
using WSolidColorBrush = Microsoft.UI.Xaml.Media.SolidColorBrush; | ||
|
||
namespace Microsoft.Maui | ||
{ | ||
public sealed class ColorConverter : UI.Xaml.Data.IValueConverter | ||
{ | ||
public object Convert(object value, Type targetType, object parameter, string language) | ||
{ | ||
var color = (Graphics.Color)value; | ||
var defaultColorKey = (string)parameter; | ||
|
||
WBrush defaultBrush = defaultColorKey != null ? | ||
(WBrush)UI.Xaml.Application.Current.Resources[defaultColorKey] : | ||
new WSolidColorBrush(Colors.Transparent); | ||
|
||
return color.IsDefault() ? defaultBrush : color.ToNative(); | ||
} | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, string language) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#nullable enable | ||
using Microsoft.UI.Xaml.Controls; | ||
|
||
namespace Microsoft.Maui | ||
{ | ||
public class MauiComboBox : ComboBox | ||
{ | ||
public MauiComboBox() | ||
{ | ||
DefaultStyleKey = typeof(MauiComboBox); | ||
|
||
DropDownOpened += OnMauiComboBoxDropDownOpened; | ||
SelectionChanged += OnMauiComboBoxSelectionChanged; | ||
} | ||
|
||
void OnMauiComboBoxDropDownOpened(object? sender, object e) | ||
{ | ||
MinWidth = ActualWidth; | ||
} | ||
|
||
void OnMauiComboBoxSelectionChanged(object? sender, SelectionChangedEventArgs e) | ||
{ | ||
MinWidth = 0; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#nullable enable | ||
using Microsoft.Maui.Graphics; | ||
using Microsoft.UI.Xaml.Controls; | ||
using WBrush = Microsoft.UI.Xaml.Media.Brush; | ||
|
||
namespace Microsoft.Maui | ||
{ | ||
public static class PickerExtensions | ||
{ | ||
public static void UpdateTitle(this MauiComboBox nativeComboBox, IPicker picker) | ||
{ | ||
nativeComboBox.Header = null; | ||
|
||
nativeComboBox.HeaderTemplate = string.IsNullOrEmpty(picker.Title) ? null : | ||
(UI.Xaml.DataTemplate)UI.Xaml.Application.Current.Resources["ComboBoxHeader"]; | ||
|
||
nativeComboBox.DataContext = picker; | ||
} | ||
public static void UpdateTextColor(this MauiComboBox nativeComboBox, IPicker picker) | ||
{ | ||
nativeComboBox.UpdateTextColor(picker, null); | ||
} | ||
|
||
public static void UpdateTextColor(this MauiComboBox nativeComboBox, IPicker picker, WBrush? defaultForeground) | ||
{ | ||
Color color = picker.TextColor; | ||
nativeComboBox.Foreground = color.IsDefault() ? (defaultForeground ?? color.ToNative()) : color.ToNative(); | ||
} | ||
|
||
public static void UpdateSelectedIndex(this MauiComboBox nativeComboBox, IPicker picker) | ||
{ | ||
nativeComboBox.SelectedIndex = picker.SelectedIndex; | ||
} | ||
|
||
public static void UpdateCharacterSpacing(this MauiComboBox nativeComboBox, IPicker picker) | ||
{ | ||
nativeComboBox.CharacterSpacing = picker.CharacterSpacing.ToEm(); | ||
} | ||
|
||
public static void UpdateFont(this MauiComboBox nativeComboBox, IPicker picker, IFontManager fontManager) => | ||
nativeComboBox.UpdateFont(picker.Font, fontManager); | ||
} | ||
} |
Oops, something went wrong.