Skip to content

Commit 32458cc

Browse files
authored
Candidate Branch September 22nd (#31681)
<!-- Please let the below note in for people that find this PR --> > [!NOTE] > Are you waiting for the changes in this PR to be merged? > It would be very helpful if you could [test the resulting artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Description of Change <!-- Enter description of the fix in this section --> ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes # <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. -->
2 parents a35ea26 + 793f2e8 commit 32458cc

File tree

742 files changed

+17130
-54
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

742 files changed

+17130
-54
lines changed

src/Controls/samples/Controls.Sample/Pages/Controls/RadioButtonGalleries/RadioButtonGroupBindingGallery.xaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<RowDefinition></RowDefinition>
1919
<RowDefinition></RowDefinition>
2020
<RowDefinition></RowDefinition>
21+
<RowDefinition></RowDefinition>
2122
</Grid.RowDefinitions>
2223

2324
<Grid.ColumnDefinitions>
@@ -28,15 +29,16 @@
2829
<Label Grid.ColumnSpan="2" Text="The RadioButtons in this Grid have a GroupName and Selection bound to a ViewModel."></Label>
2930

3031
<Label Text="{Binding GroupName, StringFormat='The GroupName is {0}'}" Grid.Row="1" />
31-
<Label Text="{Binding Selection, StringFormat='The Selection is {0}'}" Grid.Row="1" Grid.Column="1" />
32+
<Label Text="{Binding Selection, StringFormat='The Selection is {0}', TargetNullValue='The Selection is (null)'}" Grid.Row="1" Grid.Column="1" />
3233

3334
<RadioButton Content="Option A" Value="A" Grid.Row="2"></RadioButton>
3435
<RadioButton Content="Option B" Value="B" Grid.Row="2" Grid.Column="1"></RadioButton>
3536
<RadioButton Content="Option C" Value="C" Grid.Row="3"></RadioButton>
3637
<RadioButton Content="Option D" Value="D" Grid.Row="3" Grid.Column="1"></RadioButton>
3738

38-
<Button Margin="5" Grid.ColumnSpan="2" Grid.Row="4" Text="Set selection in view model to 'B'" Clicked="Button_Clicked"></Button>
39-
</Grid>
39+
<Button Margin="5" Grid.ColumnSpan="2" Grid.Row="4" Text="Set selection in view model to 'B'" Clicked="Set_Button_Clicked"></Button>
40+
<Button Margin="5" Grid.ColumnSpan="2" Grid.Row="5" Text="Clear selection in view model to 'null'" Clicked="Clear_Button_Clicked"></Button>
41+
</Grid>
4042
</StackLayout>
4143
</ContentPage.Content>
4244
</ContentPage>

src/Controls/samples/Controls.Sample/Pages/Controls/RadioButtonGalleries/RadioButtonGroupBindingGallery.xaml.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,15 @@ public RadioButtonGroupBindingGallery()
1515
BindingContext = _viewModel;
1616
}
1717

18-
private void Button_Clicked(object sender, System.EventArgs e)
18+
private void Set_Button_Clicked(object sender, System.EventArgs e)
1919
{
2020
_viewModel.Selection = "B";
2121
}
22+
23+
private void Clear_Button_Clicked(object sender, System.EventArgs e)
24+
{
25+
_viewModel.Selection = null;
26+
}
2227
}
2328

2429
public class RadioButtonGroupBindingModel : INotifyPropertyChanged

src/Controls/src/Build.Tasks/nuget/buildTransitive/netstandard2.0/Microsoft.Maui.Controls.targets

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,4 +270,14 @@
270270
</ItemGroup>
271271
</Target>
272272

273+
<Target Name="_MauiSetWinUIDefaultsForPublishAot" BeforeTargets="PrepareForBuild" Condition="'$(PublishAot)' == 'true' and '$(_MauiTargetPlatformIsWindows)' == 'True'">
274+
<PropertyGroup>
275+
<DebugSymbols Condition="'$(DebugSymbols)' == ''">false</DebugSymbols>
276+
<DebugType Condition="'$(DebugType)' == ''">None</DebugType>
277+
<EmbedXbfInPri Condition="'$(EmbedXbfInPri)' == ''">false</EmbedXbfInPri>
278+
<SelfContained Condition="'$(SelfContained)' == ''">true</SelfContained>
279+
<WindowsPackageType Condition="'$(WindowsPackageType)' == ''">None</WindowsPackageType>
280+
</PropertyGroup>
281+
</Target>
282+
273283
</Project>

src/Controls/src/Core/Compatibility/Handlers/NavigationPage/iOS/NavigationRenderer.cs

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,6 +1423,8 @@ void HandleChildPropertyChanged(object sender, PropertyChangedEventArgs e)
14231423
else if (e.PropertyName == NavigationPage.TitleIconImageSourceProperty.PropertyName ||
14241424
e.PropertyName == NavigationPage.TitleViewProperty.PropertyName)
14251425
UpdateTitleArea(Child);
1426+
else if (e.PropertyName == NavigationPage.BackButtonTitleProperty.PropertyName)
1427+
UpdateBackButtonTitle(Child);
14261428
else if (e.PropertyName == NavigationPage.IconColorProperty.PropertyName)
14271429
UpdateIconColor();
14281430
}
@@ -1944,31 +1946,20 @@ public Container(View view, UINavigationBar bar) : base(bar.Bounds)
19441946
ClipsToBounds = true;
19451947
}
19461948

1947-
UIEdgeInsets CalculateUIEdgeInsets()
1949+
public override UIEdgeInsets AlignmentRectInsets
19481950
{
1949-
var type = UIBarButtonSystemItem.FixedSpace;
1950-
var spacer = new UIBarButtonItem(type, (_, _) => { });
1951-
spacer.Width = SystemMargin + (OperatingSystem.IsIOSVersionAtLeast(11) ? 8 : -16);
1952-
1953-
nfloat screenWidth = UIScreen.MainScreen.Bounds.Size.Width;
1954-
1955-
if (!OperatingSystem.IsIOSVersionAtLeast(11) && screenWidth < 375)
1956-
{
1957-
// 3.5 and 4 inch
1958-
spacer.Width += 8;
1959-
}
1960-
else if (screenWidth >= 414)
1951+
get
19611952
{
1962-
// 5.5 inch
1963-
spacer.Width -= 4;
1953+
if (_child?.VirtualView is IView view)
1954+
{
1955+
var margin = view.Margin;
1956+
return new UIEdgeInsets(-(nfloat)margin.Top, -(nfloat)margin.Left, -(nfloat)margin.Bottom, -(nfloat)margin.Right);
1957+
}
1958+
else
1959+
{
1960+
return base.AlignmentRectInsets;
1961+
}
19641962
}
1965-
1966-
return new UIEdgeInsets(0, spacer.Width, 0, spacer.Width);
1967-
}
1968-
1969-
public override UIEdgeInsets AlignmentRectInsets
1970-
{
1971-
get => CalculateUIEdgeInsets();
19721963
}
19731964

19741965
void OnTitleViewParentSet(object sender, EventArgs e)

src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellToolbarTracker.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ protected virtual async void UpdateLeftBarButtonItem(Context context, AToolbar t
410410
var backButtonHandler = Shell.GetBackButtonBehavior(page);
411411
var text = backButtonHandler.GetPropertyIfSet(BackButtonBehavior.TextOverrideProperty, String.Empty);
412412
var command = backButtonHandler.GetPropertyIfSet<ICommand>(BackButtonBehavior.CommandProperty, null);
413+
var backButtonVisibleFromBehavior = backButtonHandler.GetPropertyIfSet(BackButtonBehavior.IsVisibleProperty, true);
413414
bool isEnabled = _shell.Toolbar.BackButtonEnabled;
414415
//Add the FlyoutIcon only if the FlyoutBehavior is Flyout
415416
var image = _flyoutBehavior == FlyoutBehavior.Flyout ? GetFlyoutIcon(backButtonHandler, page) : null;
@@ -480,7 +481,7 @@ protected virtual async void UpdateLeftBarButtonItem(Context context, AToolbar t
480481
{
481482
_drawerToggle.DrawerIndicatorEnabled = false;
482483

483-
if (backButtonVisible)
484+
if (backButtonVisibleFromBehavior && (backButtonVisible || !defaultDrawerArrowDrawable))
484485
toolbar.NavigationIcon = icon;
485486
}
486487
else if (_flyoutBehavior == FlyoutBehavior.Flyout || !defaultDrawerArrowDrawable)

src/Controls/src/Core/Handlers/Items/ItemsViewHandler.Windows.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ object FindBoundItem(ScrollToRequestEventArgs args)
659659
{
660660
if (CollectionViewSource.View[n] is ItemTemplateContext pair)
661661
{
662-
if (pair.Item == args.Item)
662+
if (Equals(pair.Item, args.Item))
663663
{
664664
return CollectionViewSource.View[n];
665665
}

src/Controls/src/Core/Handlers/Items2/iOS/LayoutFactory2.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ public static UICollectionViewLayout CreateCarouselLayout(
343343
return;
344344
}
345345

346-
var page = (offset.X + sectionMargin) / env.Container.ContentSize.Width;
346+
var page = (offset.X + sectionMargin) / (env.Container.ContentSize.Width - sectionMargin * 2);
347347

348348
if (Math.Abs(page % 1) > (double.Epsilon * 100) || cv2Controller.ItemsSource.ItemCount <= 0)
349349
{

src/Controls/src/Core/NavigationPage/NavigationPage.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,11 +869,13 @@ protected override Task OnPushAsync(Page root, bool animated)
869869
return Owner.SendHandlerUpdateAsync(animated,
870870
() =>
871871
{
872+
// Move the SendNavigating here so that it's fired prior to the stack being modified
873+
// This ensures consistent event ordering across all platforms (iOS, Catalyst, Android, Windows)
874+
Owner.SendNavigating(previousPage);
872875
Owner.PushPage(root);
873876
},
874877
() =>
875878
{
876-
Owner.SendNavigating(previousPage);
877879
Owner.FireDisappearing(previousPage);
878880
Owner.FireAppearing(root);
879881
},

src/Controls/src/Core/Platform/Windows/Extensions/AccessibilityExtensions.cs

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ public static void SetAutomationPropertiesAutomationId(this FrameworkElement Con
2525
_defaultAutomationPropertiesName = currentValue = (string)Control.GetValue(NativeAutomationProperties.NameProperty);
2626
}
2727

28-
var elemValue = (string)Element.GetValue(SemanticProperties.DescriptionProperty);
28+
#pragma warning disable CS0618 // Type or member is obsolete
29+
var elemValue = (string)Element.GetValue(AutomationProperties.NameProperty);
30+
#pragma warning restore CS0618 // Type or member is obsolete
31+
2932
string newValue = !string.IsNullOrWhiteSpace(elemValue) ? elemValue : _defaultAutomationPropertiesName;
3033

3134
if (currentValue is null || currentValue != newValue)
@@ -85,7 +88,10 @@ public static void SetAutomationPropertiesAutomationId(this FrameworkElement Con
8588
_defaultAutomationPropertiesHelpText = currentValue = (string)Control.GetValue(NativeAutomationProperties.HelpTextProperty);
8689
}
8790

88-
var elemValue = (string)Element.GetValue(SemanticProperties.HintProperty);
91+
#pragma warning disable CS0618 // Type or member is obsolete
92+
var elemValue = (string)Element.GetValue(AutomationProperties.HelpTextProperty);
93+
#pragma warning restore CS0618 // Type or member is obsolete
94+
8995
string newValue = !string.IsNullOrWhiteSpace(elemValue) ? elemValue : _defaultAutomationPropertiesHelpText;
9096

9197
if (currentValue is null || newValue != currentValue)
@@ -117,8 +123,9 @@ public static void SetAutomationPropertiesAutomationId(this FrameworkElement Con
117123
{
118124
_defaultAutomationPropertiesLabeledBy = currentValue = (UIElement)Control.GetValue(NativeAutomationProperties.LabeledByProperty);
119125
}
120-
121-
var elemValue = (VisualElement)Element.GetValue(SemanticProperties.DescriptionProperty);
126+
#pragma warning disable CS0618 // Type or member is obsolete
127+
var elemValue = (VisualElement)Element.GetValue(AutomationProperties.LabeledByProperty);
128+
#pragma warning restore CS0618 // Type or member is obsolete
122129
FrameworkElement? nativeElement = null;
123130

124131
if (mauiContext != null)
@@ -130,7 +137,9 @@ public static void SetAutomationPropertiesAutomationId(this FrameworkElement Con
130137

131138
if (currentValue is null || newValue != currentValue)
132139
{
133-
Control.SetValue(SemanticProperties.DescriptionProperty, newValue);
140+
#pragma warning disable CS0618 // Type or member is obsolete
141+
Control.SetValue(AutomationProperties.LabeledByProperty, newValue);
142+
#pragma warning restore CS0618 // Type or member is obsolete
134143
}
135144

136145
return _defaultAutomationPropertiesLabeledBy;
@@ -152,8 +161,11 @@ public static void SetBackButtonTitle(this PageControl Control, Element? Element
152161

153162
static string ConcatenateNameAndHint(Element Element)
154163
{
155-
var name = (string)Element.GetValue(SemanticProperties.DescriptionProperty);
156-
var hint = (string)Element.GetValue(SemanticProperties.HintProperty);
164+
#pragma warning disable CS0618 // Type or member is obsolete
165+
var name = (string)Element.GetValue(AutomationProperties.NameProperty);
166+
167+
var hint = (string)Element.GetValue(AutomationProperties.HelpTextProperty);
168+
#pragma warning restore CS0618 // Type or member is obsolete
157169

158170
string separator = string.IsNullOrWhiteSpace(name) || string.IsNullOrWhiteSpace(hint) ? "" : ". ";
159171

src/Controls/src/Core/Platform/Windows/Extensions/TextBlockExtensions.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,16 @@ public static void UpdateText(this TextBlock platformControl, Label label)
3434

3535
default:
3636
if (label.FormattedText != null)
37+
{
3738
platformControl.UpdateInlines(label);
39+
}
3840
else
3941
{
40-
if (platformControl.TextHighlighters.Count > 0)
42+
if (!label.IsConnectingHandler() && platformControl.TextHighlighters.Count > 0)
4143
{
4244
platformControl.TextHighlighters.Clear();
4345
}
46+
4447
platformControl.Text = text;
4548
}
4649
break;
@@ -69,15 +72,21 @@ public static void UpdateMaxLines(this TextBlock platformControl, Label label)
6972
public static void UpdateDetectReadingOrderFromContent(this TextBlock platformControl, Label label)
7073
{
7174
if (label.IsSet(Specifics.DetectReadingOrderFromContentProperty))
75+
{
7276
platformControl.SetTextReadingOrder(label.OnThisPlatform().GetDetectReadingOrderFromContent());
77+
}
7378
}
7479

7580
internal static void SetLineBreakMode(this TextBlock textBlock, LineBreakMode lineBreakMode, int? maxLines = null)
7681
{
7782
if (maxLines.HasValue && maxLines >= 0)
83+
{
7884
textBlock.MaxLines = maxLines.Value;
85+
}
7986
else
87+
{
8088
textBlock.MaxLines = 0;
89+
}
8190

8291
switch (lineBreakMode)
8392
{

0 commit comments

Comments
 (0)