Hello,
============Update==============
so what I want to do is to remove this,
If you move the AppTitleBar from layout background code to the TurbinesCollectionPageViewModel
. I create a TurbinesCollectionPageViewModel's constructor, and move the code in it. You can refer to the following code.
public partial class TurbinesCollectionPageViewModel
: ChargingStationsMapPageViewModel{
public TurbinesCollectionPageViewModel(TurbinesService turbinesService) : base(turbinesService)
{
var tb = new AppTitleBar();
tb.UpdateItemSource(TurbinePins,
"Turbine.Name", "Turbine.Name");
App.WindowInstance!.TitleBar = tb;
ColletionComboBox = tb.ComboBox;
tb.ComboBox.SelectionChanged += ComboBox_SelectionChanged;
}
private async void ComboBox_SelectionChanged(object? sender,
Syncfusion.Maui.Inputs.SelectionChangedEventArgs e)
{
if (sender is SfComboBox comboBox
&& comboBox.SelectedValue is TurbinePin selectedPin)
{
// Zoom into the selected turbine's location
ItemSelectedCommand.Execute(selectedPin.Turbine);
// Wait for a short duration before navigation
await Task.Delay(1000);
// Navigate to the turbine detail page
PinMarkerClicked(selectedPin);
comboBox.SelectedItem = string.Empty;
}
}
Based on your description, The custom AppTitleBar
and <inputLayout:SfTextInputLayout>
will work for different platforms. You cannot remove them easily.
However, you can use custom them for different platforms.
You can control inputLayout:SfTextInputLayout.IsVisible
by platforms, for Android and iOS, you can set IsVisible to true. For Windows platform, you can set IsVisible to false. You can refer to the following code.
<inputLayout:SfTextInputLayout
x:Name="MobileContent"
Style="{x:StaticResource TurbineCollectionComboBoxStyle}">
<inputLayout:SfTextInputLayout.IsVisible>
<OnPlatform x:TypeArguments="x:Boolean">
<On Platform="iOS" Value="true" />
<On Platform="Android" Value="true" />
<On Platform="Windows" Value="false" />
</OnPlatform>
</inputLayout:SfTextInputLayout.IsVisible>
...
</inputLayout:SfTextInputLayout>
Best Regards,
Leon Lu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.