В Xamarin у меня есть TabbedPage, который иногда должен отображаться, а иногда нет.
<ContentPage x:Name="tab_Voeding5" IsEnabled="False">
<StackLayout>
<Label Text="Voeding pagina 5"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand" />
</StackLayout>
</ContentPage>
Я попытался отключить его по умолчанию и включить так:
if(Application.Current.Properties["txt_voeding5"].ToString() != "")
{
tab_Voeding5.IsEnabled = true;
tab_Voeding5.Title = Application.Current.Properties["txt_voeding5"].ToString();
}
Однако это только отключает и включает заголовок страницы с вкладками на панели навигации, но я хочу, чтобы он был полностью удален / добавлен. Как мне это сделать?
Кроме того, в Tabbar.axml
я хочу app:tabMode="scrollable"
только на странице A. Я хочу, чтобы он был по умолчанию, как app:tabMode="fixed"
. Как программно изменить app:tabMode
в файле CS страницы?
EDIT:
Файл Xaml
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="TimeToSport.Views.VoedingPage"
Title="Voeding">
<!-- Voeding 1 -->
<ContentPage x:Name="tab_Voeding1">
<StackLayout>
<Label Text="Voeding pagina 1"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand" />
</StackLayout>
</ContentPage>
<!-- Voeding 2 -->
<ContentPage x:Name="tab_Voeding2">
<StackLayout>
<Label Text="Voeding pagina 2"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand" />
</StackLayout>
</ContentPage>
<!-- Voeding 3 -->
<ContentPage x:Name="tab_Voeding3">
<StackLayout>
<Label Text="Voeding pagina 3"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand" />
</StackLayout>
</ContentPage>
<!-- Voeding 4 -->
<ContentPage x:Name="tab_Voeding4">
<StackLayout>
<Label Text="Voeding pagina 4"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand" />
</StackLayout>
</ContentPage>
<!-- Voeding 5 -->
<ContentPage x:Name="tab_Voeding5" IsEnabled="False">
<StackLayout>
<Label Text="Voeding pagina 5"
VerticalOptions="CenterAndExpand"
HorizontalOptions="CenterAndExpand" />
</StackLayout>
</ContentPage>
</TabbedPage>