Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Controls/src/Core/RadioButton/RadioButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public partial class RadioButton : TemplatedView, IElementConfiguration<RadioBut
public static readonly BindableProperty ValueProperty =
BindableProperty.Create(nameof(Value), typeof(object), typeof(RadioButton), null,
propertyChanged: (b, o, n) => ((RadioButton)b).OnValuePropertyChanged(),
coerceValue: (b, o) => o ?? b);
coerceValue: (b, o) => o ?? b);

/// <summary>Bindable property for <see cref="IsChecked"/>.</summary>
public static readonly BindableProperty IsCheckedProperty = BindableProperty.Create(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,16 @@ void UpdateGroupNames(Element element, string name, string oldName = null)

void SetSelectedValue(object radioButtonValue)
{
if(object.Equals(_selectedValue, radioButtonValue))
if (object.Equals(_selectedValue, radioButtonValue))
{
return;
}

_selectedValue = radioButtonValue;

#pragma warning disable CS0618 // TODO: Remove when we internalize/replace MessagingCenter
MessagingCenter.Send<Element, RadioButtonGroupValueChanged>(_layout, RadioButtonGroup.GroupValueChangedMessage,
new RadioButtonGroupValueChanged(_groupName, RadioButtonGroup.GetVisualRoot(_layout), radioButtonValue));
MessagingCenter.Send<Element, RadioButtonGroupValueChanged>(_layout, RadioButtonGroup.GroupValueChangedMessage,
new RadioButtonGroupValueChanged(_groupName, RadioButtonGroup.GetVisualRoot(_layout), radioButtonValue));
#pragma warning restore CS0618 // Type or member is obsolete

}
Expand Down
2 changes: 1 addition & 1 deletion src/Controls/tests/Core.UnitTests/RadioButtonTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public void GroupNullSelectionClearsAnySelection()
public void ValuePropertyCoercedToItselfIfSetToNull()
{
var radioButton = new RadioButton();

Assert.Equal(radioButton, radioButton.Value);

radioButton.Value = null;
Expand Down
214 changes: 107 additions & 107 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue31520.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,121 +3,121 @@ namespace Maui.Controls.Sample.Issues;
[Issue(IssueTracker.Github, 31520, "NavigatingFrom is triggered first when using PushAsync", PlatformAffected.Android)]
public class Issue31520 : NavigationPage
{
public static int count = 0;
public static Label statusLabel;
public static Issue31520Page2 currentPage2;
public static int count = 0;
public static Label statusLabel;
public static Issue31520Page2 currentPage2;

public Issue31520() : base(new Issue31520Page1())
{
public Issue31520() : base(new Issue31520Page1())
{

}
}
}

public class Issue31520Page1 : ContentPage
{
public Issue31520Page1()
{
SetupPageContent();

Disappearing += (s, e) =>
{
Issue31520.count++;
};

NavigatingFrom += (s, e) =>
{
if (Issue31520.statusLabel is not null)
{
Issue31520.statusLabel.Text = (Issue31520.count == 0)
? "NavigatingFrom triggered before Disappearing"
: "NavigatingFrom triggered after Disappearing";

Issue31520.currentPage2?.UpdateNavigatingStatusLabel();
}
};
}

private void SetupPageContent()
{
Title = "Page 1";

Issue31520.statusLabel = new Label
{
Text = "Ready",
AutomationId = "statusLabel"
};

var button = new Button
{
Text = "Push",
AutomationId = "PushButton"
};
button.Clicked += OnCounterClicked;

Content = new VerticalStackLayout
{
Padding = new Thickness(30, 0),
Spacing = 25,
Children =
{
Issue31520.statusLabel,
button
}
};
}

private void OnCounterClicked(object sender, EventArgs e)
{
Navigation.PushAsync(new Issue31520Page2());
}
public Issue31520Page1()
{
SetupPageContent();

Disappearing += (s, e) =>
{
Issue31520.count++;
};

NavigatingFrom += (s, e) =>
{
if (Issue31520.statusLabel is not null)
{
Issue31520.statusLabel.Text = (Issue31520.count == 0)
? "NavigatingFrom triggered before Disappearing"
: "NavigatingFrom triggered after Disappearing";

Issue31520.currentPage2?.UpdateNavigatingStatusLabel();
}
};
}

private void SetupPageContent()
{
Title = "Page 1";

Issue31520.statusLabel = new Label
{
Text = "Ready",
AutomationId = "statusLabel"
};

var button = new Button
{
Text = "Push",
AutomationId = "PushButton"
};
button.Clicked += OnCounterClicked;

Content = new VerticalStackLayout
{
Padding = new Thickness(30, 0),
Spacing = 25,
Children =
{
Issue31520.statusLabel,
button
}
};
}

private void OnCounterClicked(object sender, EventArgs e)
{
Navigation.PushAsync(new Issue31520Page2());
}
}

public class Issue31520Page2 : ContentPage
{
private Label navigatingStatusLabel;

public Issue31520Page2()
{
Issue31520.currentPage2 = this;

Appearing += (s, e) =>
{
Issue31520.count++;
};

Title = "Page 2";

var button = new Button
{
Text = "Pop",
AutomationId = "ChildPageButton"
};
button.Clicked += OnButtonClicked;

navigatingStatusLabel = new Label
{
Text = Issue31520.statusLabel?.Text ?? "Ready",
AutomationId = "NavigatingStatusLabel"
};

Content = new StackLayout
{
Children =
{
navigatingStatusLabel,
button
}
};
}

public void UpdateNavigatingStatusLabel()
{
if (navigatingStatusLabel is not null && Issue31520.statusLabel is not null)
navigatingStatusLabel.Text = Issue31520.statusLabel.Text;
}

private void OnButtonClicked(object sender, EventArgs e)
{
Navigation.PopAsync();
}
private Label navigatingStatusLabel;

public Issue31520Page2()
{
Issue31520.currentPage2 = this;

Appearing += (s, e) =>
{
Issue31520.count++;
};

Title = "Page 2";

var button = new Button
{
Text = "Pop",
AutomationId = "ChildPageButton"
};
button.Clicked += OnButtonClicked;

navigatingStatusLabel = new Label
{
Text = Issue31520.statusLabel?.Text ?? "Ready",
AutomationId = "NavigatingStatusLabel"
};

Content = new StackLayout
{
Children =
{
navigatingStatusLabel,
button
}
};
}

public void UpdateNavigatingStatusLabel()
{
if (navigatingStatusLabel is not null && Issue31520.statusLabel is not null)
navigatingStatusLabel.Text = Issue31520.statusLabel.Text;
}

private void OnButtonClicked(object sender, EventArgs e)
{
Navigation.PopAsync();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ public partial class Issue7045 : Shell
public Issue7045()
{
InitializeComponent();
NavigateButton.Clicked += async (s, e) => await Current.GoToAsync($"//DetialPage"); ;
NavigateButton.Clicked += async (s, e) => await Current.GoToAsync($"//DetialPage");
;
DetailPage.BindingContext = this;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# if TEST_FAILS_ON_ANDROID && TEST_FAILS_ON_WINDOWS // BackButtonTitle is only applicable for iOS and macOS
#if TEST_FAILS_ON_ANDROID && TEST_FAILS_ON_WINDOWS // BackButtonTitle is only applicable for iOS and macOS
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;
Expand Down