Skip to content
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

When mounted, TabStrip changes SelectedItem to the first one and then reverts it back #15891

Open
optsing opened this issue Jun 2, 2024 · 1 comment
Labels

Comments

@optsing
Copy link

optsing commented Jun 2, 2024

Describe the bug

When mounted, TabStrip changes SelectedItem to the first one and then reverts it back.

To Reproduce

Add TabStrip to View, add TabItems and CurrentItem to ViewModel, watch CurrentItem changes.

public partial class MainViewModel : ViewModelBase
{
    public List<string> TabItems { get; } = ["Tab1", "Tab2", "Tab3"];

    [ObservableProperty]
    public string currentItem = "Tab2";

    partial void OnCurrentItemChanged(string value)
    {
        Debug.WriteLine(value);
    }
}

Just run the application and look at the logs:

Tab1
Tab2

Expected behavior

TabStrip should not change SelectedItem when mounted, like ListBox does not change it.

Avalonia version

11.0.10

OS

Windows

Additional context

No response

@optsing optsing added the bug label Jun 2, 2024
@optsing
Copy link
Author

optsing commented Jun 14, 2024

Apparently, the problem is with AlwaysSelected in SelectingItemsControl.cs and is relevant for 11.1.0-rc1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant