diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index e21dc40f53e3..c15a5babb4c5 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -21,7 +21,7 @@ ] }, "microsoft.dotnet.xharness.cli": { - "version": "10.0.0-prerelease.24466.1", + "version": "10.0.0-prerelease.24467.4", "commands": [ "xharness" ] diff --git a/.github/workflows/similarIssues.yml b/.github/workflows/similarIssues.yml deleted file mode 100644 index ecba7b66952e..000000000000 --- a/.github/workflows/similarIssues.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: GitGudSimilarIssues comments - -on: - issues: - types: [opened] - issue_comment: - types: [created] - -jobs: - getSimilarIssues: - runs-on: ubuntu-latest - if: >- - (github.event_name == 'issues' && github.event.action == 'opened') || - (github.event_name == 'issue_comment' && github.event.action == 'created' && startsWith(github.event.comment.body, '/similarissues')) - outputs: - message: ${{ steps.getBody.outputs.message }} - steps: - - id: getBody - uses: craigloewen-msft/GitGudSimilarIssues@main - with: - issueTitle: ${{ github.event.issue.title }} - issueBody: ${{ github.event.issue.body }} - repo: ${{ github.repository }} - similaritytolerance: "0.70" - add-comment: - needs: getSimilarIssues - runs-on: ubuntu-latest - permissions: - issues: write - if: needs.getSimilarIssues.outputs.message != '' - steps: - - name: Add comment - run: gh issue comment "$NUMBER" --repo "$REPO" --body "$BODY" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NUMBER: ${{ github.event.issue.number }} - REPO: ${{ github.repository }} - BODY: ${{ needs.getSimilarIssues.outputs.message }} diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 74620a45509c..459f6e029f5b 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,16 +1,16 @@ - + https://github.com/dotnet/xharness - f20e52f7731da99588dd6b4f4bd60119f03220a3 + 3cfb1a3d86da666fb80ba0adb970525e88339d57 - + https://github.com/dotnet/xharness - f20e52f7731da99588dd6b4f4bd60119f03220a3 + 3cfb1a3d86da666fb80ba0adb970525e88339d57 - + https://github.com/dotnet/xharness - f20e52f7731da99588dd6b4f4bd60119f03220a3 + 3cfb1a3d86da666fb80ba0adb970525e88339d57 diff --git a/eng/Versions.props b/eng/Versions.props index 67b5cbd4af12..7a44fbed453f 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -105,9 +105,9 @@ <_HarfBuzzSharpVersion>7.3.0.2 <_SkiaSharpNativeAssetsVersion>0.0.0-commit.7af1d0840a381c0ce7ef2877454a88dbb2949686.1086 7.0.114 - 10.0.0-prerelease.24466.1 - 10.0.0-prerelease.24466.1 - 10.0.0-prerelease.24466.1 + 10.0.0-prerelease.24467.4 + 10.0.0-prerelease.24467.4 + 10.0.0-prerelease.24467.4 0.9.2 1.0.0.16 1.3.0 diff --git a/src/Controls/src/Core/Compatibility/Handlers/NavigationPage/iOS/NavigationRenderer.cs b/src/Controls/src/Core/Compatibility/Handlers/NavigationPage/iOS/NavigationRenderer.cs index 1b86f611ad6e..f440a7b9693d 100644 --- a/src/Controls/src/Core/Compatibility/Handlers/NavigationPage/iOS/NavigationRenderer.cs +++ b/src/Controls/src/Core/Compatibility/Handlers/NavigationPage/iOS/NavigationRenderer.cs @@ -502,7 +502,7 @@ void HandlePropertyChanged(object sender, PropertyChangedEventArgs e) { UpdateUseLargeTitles(); } - else if (e.PropertyName == NavigationPage.BackButtonTitleProperty.PropertyName) + else if (e.PropertyName == NavigationPage.BackButtonTitleProperty.PropertyName || e.PropertyName == NavigationPage.TitleProperty.PropertyName) { var pack = (ParentingViewController)TopViewController; pack?.UpdateTitleArea(pack.Child); @@ -1508,16 +1508,17 @@ internal void UpdateTitleArea(Page page) if (!(OperatingSystem.IsIOSVersionAtLeast(11) || OperatingSystem.IsMacCatalystVersionAtLeast(11)) && !isBackButtonTextSet) backButtonText = ""; + _navigation.TryGetTarget(out NavigationRenderer n); + // First page and we have a flyout detail to contend with UpdateLeftBarButtonItem(); - UpdateBackButtonTitle(page.Title, backButtonText); + UpdateBackButtonTitle(page.Title ?? n?.NavPage.Title, backButtonText); //var hadTitleView = NavigationItem.TitleView != null; ClearTitleViewContainer(); if (needContainer) { - NavigationRenderer n; - if (!_navigation.TryGetTarget(out n)) + if (n is null) return; Container titleViewContainer = new Container(titleView, n.NavigationBar); diff --git a/src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellSectionRenderer.cs b/src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellSectionRenderer.cs index 32c8a6b7a12b..24ceab4a95cf 100644 --- a/src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellSectionRenderer.cs +++ b/src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellSectionRenderer.cs @@ -149,6 +149,30 @@ public override AView OnCreateView(LayoutInflater inflater, ViewGroup container, return _rootView = root; } + void OnShellContentPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) + { + if (e.PropertyName == ShellContent.TitleProperty.PropertyName && sender is ShellContent shellContent) + { + UpdateTabTitle(shellContent); + } + } + + void UpdateTabTitle(ShellContent shellContent) + { + if (_tablayout == null || SectionController.GetItems().Count == 0) + return; + + int index = SectionController.GetItems().IndexOf(shellContent); + if (index >= 0) + { + var tab = _tablayout.GetTabAt(index); + if (tab != null) + { + tab.SetText(new string(shellContent.Title)); + } + } + } + void OnTabLayoutChange(object sender, AView.LayoutChangeEventArgs e) { if (_disposed) @@ -327,6 +351,10 @@ void HookEvents() SectionController.ItemsCollectionChanged += OnItemsCollectionChanged; ((IShellController)_shellContext.Shell).AddAppearanceObserver(this, ShellSection); ShellSection.PropertyChanged += OnShellItemPropertyChanged; + foreach (var item in SectionController.GetItems()) + { + item.PropertyChanged += OnShellContentPropertyChanged; + } } void UnhookEvents() @@ -334,6 +362,10 @@ void UnhookEvents() SectionController.ItemsCollectionChanged -= OnItemsCollectionChanged; ((IShellController)_shellContext?.Shell)?.RemoveAppearanceObserver(this); ShellSection.PropertyChanged -= OnShellItemPropertyChanged; + foreach (var item in SectionController.GetItems()) + { + item.PropertyChanged -= OnShellContentPropertyChanged; + } } protected virtual void OnPageSelected(int position) diff --git a/src/Controls/src/Core/Element/Element.cs b/src/Controls/src/Core/Element/Element.cs index 8c3c13e013af..f8a193e6c3e1 100644 --- a/src/Controls/src/Core/Element/Element.cs +++ b/src/Controls/src/Core/Element/Element.cs @@ -747,7 +747,7 @@ internal void OnResourcesChanged(IEnumerable> value internal override void OnSetDynamicResource(BindableProperty property, string key, SetterSpecificity specificity) { base.OnSetDynamicResource(property, key, specificity); - if (!DynamicResources.TryGetValue(property, out var existing) || existing.Item2.CompareTo(specificity) < 0) + if (!DynamicResources.TryGetValue(property, out var existing) || existing.Item2.CompareTo(specificity) <= 0) DynamicResources[property] = (key, specificity); if (this.TryGetResource(key, out var value)) OnResourceChanged(property, value, specificity); diff --git a/src/Controls/src/Core/Handlers/Shell/ShellContentHandler.Windows.cs b/src/Controls/src/Core/Handlers/Shell/ShellContentHandler.Windows.cs index 776e69c38373..3ae9eb434f34 100644 --- a/src/Controls/src/Core/Handlers/Shell/ShellContentHandler.Windows.cs +++ b/src/Controls/src/Core/Handlers/Shell/ShellContentHandler.Windows.cs @@ -7,7 +7,7 @@ namespace Microsoft.Maui.Controls.Handlers public partial class ShellContentHandler : ElementHandler { public static PropertyMapper Mapper = - new PropertyMapper(ElementMapper); + new PropertyMapper(ElementMapper) { [nameof(ShellContent.Title)] = MapTitle }; public static CommandMapper CommandMapper = new CommandMapper(ElementCommandMapper); @@ -16,6 +16,14 @@ public ShellContentHandler() : base(Mapper, CommandMapper) { } + internal static void MapTitle(ShellContentHandler handler, ShellContent item) + { + var shellSection = item.Parent as ShellSection; + var shellItem = shellSection?.Parent as ShellItem; + var shellItemHandler = shellItem?.Handler as ShellItemHandler; + shellItemHandler?.UpdateTitle(); + } + protected override FrameworkElement CreatePlatformElement() { return (VirtualView as IShellContentController).GetOrCreateContent().ToPlatform(MauiContext); diff --git a/src/Controls/src/Core/NavigationPage/NavigationPageToolbar.cs b/src/Controls/src/Core/NavigationPage/NavigationPageToolbar.cs index 9e58809acca2..f51ff1e35388 100644 --- a/src/Controls/src/Core/NavigationPage/NavigationPageToolbar.cs +++ b/src/Controls/src/Core/NavigationPage/NavigationPageToolbar.cs @@ -273,7 +273,7 @@ string GetTitle() return string.Empty; } - return _currentNavigationPage?.CurrentPage?.Title; + return _currentNavigationPage?.CurrentPage?.Title ?? _currentNavigationPage?.Title; } VisualElement GetTitleView() diff --git a/src/Controls/src/Core/PublicAPI/net-windows/PublicAPI.Unshipped.txt b/src/Controls/src/Core/PublicAPI/net-windows/PublicAPI.Unshipped.txt index 7dc5c58110bf..815c92006af7 100644 --- a/src/Controls/src/Core/PublicAPI/net-windows/PublicAPI.Unshipped.txt +++ b/src/Controls/src/Core/PublicAPI/net-windows/PublicAPI.Unshipped.txt @@ -1 +1 @@ -#nullable enable +#nullable enable \ No newline at end of file diff --git a/src/Controls/src/Core/Shell/BaseShellItem.cs b/src/Controls/src/Core/Shell/BaseShellItem.cs index c1593aafcf2f..25aa1605e65c 100644 --- a/src/Controls/src/Core/Shell/BaseShellItem.cs +++ b/src/Controls/src/Core/Shell/BaseShellItem.cs @@ -51,7 +51,7 @@ public class BaseShellItem : NavigableElement, IPropertyPropagationController, I /// Bindable property for . public static readonly BindableProperty TitleProperty = - BindableProperty.Create(nameof(Title), typeof(string), typeof(BaseShellItem), null, BindingMode.OneTime, propertyChanged: OnTitlePropertyChanged); + BindableProperty.Create(nameof(Title), typeof(string), typeof(BaseShellItem), null, BindingMode.TwoWay, propertyChanged: OnTitlePropertyChanged); /// Bindable property for . public static readonly BindableProperty IsVisibleProperty = diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ChangeShellContentTitle.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ChangeShellContentTitle.png new file mode 100644 index 000000000000..ab55034b484c Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ChangeShellContentTitle.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/NavigationPageTitle.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/NavigationPageTitle.png new file mode 100644 index 000000000000..3699d81a9306 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/NavigationPageTitle.png differ diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue19859.xaml b/src/Controls/tests/TestCases.HostApp/Issues/Issue19859.xaml new file mode 100644 index 000000000000..44b1ffcefc3d --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue19859.xaml @@ -0,0 +1,40 @@ + + + + + + +