-
Notifications
You must be signed in to change notification settings - Fork 2k
[iOS & Catalyst ] Fixed IsEnabled property should work on Tabs #33369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
PureWeen
merged 2 commits into
dotnet:inflight/current
from
SubhikshaSf4851:Fix-33158-GeneralChanges
Jan 5, 2026
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
130 changes: 130 additions & 0 deletions
130
src/Controls/tests/TestCases.HostApp/Issues/Issue33158.cs
This file contains hidden or 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,130 @@ | ||
| namespace Maui.Controls.Sample.Issues; | ||
|
|
||
| [Issue(IssueTracker.Github, 33158, "IsEnabledProperty should work on Tabs", PlatformAffected.iOS)] | ||
| public class Issue33158 : Shell | ||
| { | ||
| public Issue33158() | ||
| { | ||
| var mainPageTab = new Tab | ||
| { | ||
| Title = "FirstPage", | ||
| IsEnabled = true, | ||
| }; | ||
| mainPageTab.Items.Add(new ShellContent | ||
| { | ||
| ContentTemplate = new DataTemplate(() => new Issue33158MainPage()) | ||
| }); | ||
|
|
||
| var secondPageTab = new Tab | ||
| { | ||
| Title = "SecondTab", | ||
| IsEnabled = false, | ||
| AutomationId = "SecondTab" | ||
| }; | ||
| secondPageTab.Items.Add(new ShellContent | ||
| { | ||
| ContentTemplate = new DataTemplate(() => new Issue33158SecondPage()) | ||
| }); | ||
| var thirdTab = new Tab | ||
| { | ||
| Title = "ThirdTab", | ||
| IsEnabled = true, | ||
| AutomationId = "ThirdTab" | ||
| }; | ||
| thirdTab.Items.Add(new ShellContent | ||
| { | ||
| ContentTemplate = new DataTemplate(() => new Issue33158ThirdPage()) | ||
| }); | ||
| var tabBar = new TabBar(); | ||
| tabBar.Items.Add(mainPageTab); | ||
| tabBar.Items.Add(secondPageTab); | ||
| tabBar.Items.Add(thirdTab); | ||
| Items.Add(tabBar); | ||
| } | ||
|
|
||
| public class Issue33158MainPage : ContentPage | ||
| { | ||
| public Issue33158MainPage() | ||
| { | ||
| Content = new StackLayout | ||
| { | ||
| VerticalOptions = LayoutOptions.Center, | ||
| HorizontalOptions = LayoutOptions.Center, | ||
| Children = | ||
| { | ||
| new Label | ||
| { | ||
| Text = "This is First Page", | ||
| } | ||
| } | ||
| }; | ||
| } | ||
| } | ||
|
|
||
| public class Issue33158SecondPage : ContentPage | ||
| { | ||
| public Issue33158SecondPage() | ||
| { | ||
| Content = new StackLayout | ||
| { | ||
| VerticalOptions = LayoutOptions.Center, | ||
| HorizontalOptions = LayoutOptions.Center, | ||
| Children = | ||
| { | ||
| new Label | ||
| { | ||
| Text = "This is Second Page", | ||
| AutomationId = "SecondPageLabel" | ||
| } | ||
| } | ||
| }; | ||
| } | ||
| } | ||
| public class Issue33158ThirdPage : ContentPage | ||
| { | ||
| public Issue33158ThirdPage() | ||
| { | ||
| var label = new Label | ||
| { | ||
| Text = "This is Third Page", | ||
| HorizontalOptions = LayoutOptions.Center, | ||
| VerticalOptions = LayoutOptions.Center, | ||
| AutomationId = "ThirdPageLabel" | ||
| }; | ||
|
|
||
| var button = new Button | ||
| { | ||
| Text = "Enable SecondTab", | ||
| HorizontalOptions = LayoutOptions.Center, | ||
| VerticalOptions = LayoutOptions.Center, | ||
| AutomationId = "EnableSecondTab" | ||
| }; | ||
| button.Clicked += OnButtonClicked; | ||
| Content = new StackLayout | ||
| { | ||
| VerticalOptions = LayoutOptions.Center, | ||
| HorizontalOptions = LayoutOptions.Center, | ||
| Children = | ||
| { | ||
| label, | ||
| button | ||
| } | ||
| }; | ||
| } | ||
|
|
||
| private void OnButtonClicked(object sender, EventArgs e) | ||
| { | ||
| if (Application.Current?.Windows.Count > 0 && | ||
| Application.Current.Windows[0].Page is Shell shell) | ||
| { | ||
| var secondTab = shell.CurrentItem?.Items[1]; | ||
| if (secondTab is not null) | ||
| secondTab.IsEnabled = true; | ||
| } | ||
| else | ||
| { | ||
| System.Diagnostics.Debug.WriteLine("Shell not found!"); | ||
| } | ||
| } | ||
| } | ||
| } |
30 changes: 30 additions & 0 deletions
30
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue33158.cs
This file contains hidden or 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,30 @@ | ||
| #if TEST_FAILS_ON_WINDOWS // Existing PR for windows - https://github.com/dotnet/maui/pull/26728 | ||
| using NUnit.Framework; | ||
| using UITest.Appium; | ||
| using UITest.Core; | ||
|
|
||
| namespace Microsoft.Maui.TestCases.Tests.Issues; | ||
|
|
||
| public class Issue33158 : _IssuesUITest | ||
| { | ||
| public Issue33158(TestDevice testDevice) : base(testDevice) | ||
| { | ||
| } | ||
|
|
||
| public override string Issue => "IsEnabledProperty should work on Tabs"; | ||
|
|
||
| [Test] | ||
| [Category(UITestCategories.Shell)] | ||
| public void Issue33158CheckIsEnabled() | ||
| { | ||
| App.WaitForElement("ThirdTab"); | ||
| App.Tap("ThirdTab"); | ||
| App.WaitForElement("ThirdPageLabel"); | ||
| App.Tap("SecondTab"); | ||
| App.WaitForNoElement("SecondPageLabel"); | ||
| App.Tap("EnableSecondTab"); | ||
| App.Tap("SecondTab"); | ||
| App.WaitForElement("SecondPageLabel"); | ||
| } | ||
| } | ||
| #endif |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.