enisn / UraniumUI

Uranium is a Free & Open-Source UI Kit for MAUI.
Apache License 2.0
1.17k stars 142 forks source link

Add Methods to allow changing TabView TabItems by code. - Feature Request #40

Open Geramy opened 2 years ago

Geramy commented 2 years ago

Hi I was wondering if it would be possible for you to add a method or procedure to change the tabs to the TabView manually in code. Such as a function that allows us to activate a tab via method using x:Name, position, and/or Title?

Thank you.

enisn commented 2 years ago

There is a property named CurrentItem in TabView https://github.com/enisn/UraniumUI/blob/master/src/UraniumUI.Material/Controls/TabView.BindableProperties.cs#L12

So you can define a name and set current item via using that name.

<material:TabView x:Name="myTab">
<!-- ... -->
</material:TabView>
private void ShowFirstTab()
{
    myTab.CurrentItem = myTab.Items[0];
}
Geramy commented 2 years ago

I’ll try this in the morning I attempted it but I was having problems. Not sure if it was just a delay in ui or something on my end.

On Tue, Sep 20, 2022 at 10:58 PM Enis Necipoglu @.***> wrote:

There is a property named CurrentItem in TabView

https://github.com/enisn/UraniumUI/blob/master/src/UraniumUI.Material/Controls/TabView.BindableProperties.cs#L12

So you can define a name and set current item via using that name.

private void ShowFirstTab() { myTab.CurrentItem = myTab.Items[0]; } — Reply to this email directly, view it on GitHub , or unsubscribe . You are receiving this because you authored the thread.Message ID: ***@***.***> --

Geramy L. Loveless