I'm developing an Android-only app using MAUI.NET. I'm using the DevExpress library, in particular the TabView control. I've split my editing forms into ContentView objects to be displayed by the tabs.
Item.xaml:
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Mobile.Views.Item"
xmlns:dxco="clr-namespace:DevExpress.Maui.Controls;assembly=DevExpress.Maui.Controls"
xmlns:views="clr-namespace:Mobile.Views.Item"
Title="Item">
<dxco:TabView x:Name="TabView">
<dxco:TabViewItem HeaderText="Edit 1">
<views:Edit1 x:Name="Edit1Tab"/>
</dxco:TabViewItem>
<dxco:TabViewItem HeaderText="Edit 2">
<views:Edit2 x:Name="Edit2Tab"/>
</dxco:TabViewItem>
</dxco:TabView>
</ContentPage>
Edit1.xaml:
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Mobile.Views.Item.Edit1">
<ScrollView>
<Grid Margin="20">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<VerticalStackLayout Grid.Row="0">
<Label Text="NAME" FontSize="Caption"/>
<Entry x:Name="ItemName" Keyboard="Default" ClearButtonVisibility="WhileEditing"/>
</VerticalStackLayout>
</Grid>
</ScrollView>
</ContentView>
Edit2.xaml
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Mobile.Views.Item.Edit2">
<ScrollView>
<Grid Margin="20">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<VerticalStackLayout Grid.Row="0">
<Label Text="CATEGORY" FontSize="Caption"/>
<Picker x:Name="ItemCategory">
<Picker.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>Category 1</x:String>
<x:String>Category 2</x:String>
<x:String>Category 3</x:String>
<x:String>Category 4</x:String>
</x:Array>
</Picker.ItemsSource>
</Picker>
</VerticalStackLayout>
</Grid>
</ScrollView>
</ContentView>
I haven't wired-up models, binding or the code behind yet, so the views only have the constructors with the InitializeComponent()
methods. The TabView works as expected, but when I select the Edit2 tab, the ItemCategory Picker is immediately opened.
I've tried utilizing the ItemHeaderTapped
event of the TabView to set a flag, then check the value in the ItemCategory Focused
event and call the Unfocus()
method, but it still opens. I've also tried the Focused
event on the ContentView, but it doesn't seem to fire when the tab is selected. I've looked through the DevExpress documentation, but found nothing relevant.
Is there anyway to prevent this?