我正在开发一个.Net Maui应用程序,并面临集合视图的问题,更具体地说是列表视图,即使我尝试通过替换列表视图来尝试可绑定布局(如堆栈布局),问题仍然存在。
只能点击前几个项目。当我调试时,代码隐藏中的函数甚至命令(在视图模型中)都不会被触发。
对于点击项目,我使用列表视图的单击事件和可绑定布局的手势识别器。点击该项目后,我需要转到详细信息页面。所有项目的行为应该相同,而不是前几个项目。
通过在边框内添加可绑定布局,Android 上的问题得到解决,但 IOS 上的问题仍然存在。
参考如下xaml代码:
<?xml version="1.0" encoding="utf-8"?>
<ContentPage
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MobileApp_MAUI.Views.Support.SupportPage"
xmlns:model="clr-namespace:MobileApp_MAUI.Model"
xmlns:viewmodel="clr-namespace:MobileApp_MAUI.ViewModel"
xmlns:itemtemplate="clr-namespace:MobileApp_MAUI.Views.ContactUs.Templates"
x:DataType="viewmodel:SupportPageViewModel"
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
Title="Support">
<ScrollView VerticalScrollBarVisibility="Never" HorizontalScrollBarVisibility="Never" Grid.Row="0" VerticalOptions="FillAndExpand">
<StackLayout BackgroundColor="#f5f2ed">
<!--MAIN HEADER-->
<Grid BackgroundColor="{StaticResource XBlue}" Margin="0,0,0,10">
<Grid.RowDefinitions>
<RowDefinition Height="180" />
</Grid.RowDefinitions>
<Label Text="You can browse the frequently asked questions using the search bar or browse by clicking the topic buttons below. If you cannot find the answer to your question please contact us."
LineBreakMode="WordWrap"
HorizontalOptions="Center"
VerticalOptions="Center" BackgroundColor="#004A4A"
Padding="20,25,20,25" TextColor="White" …Run Code Online (Sandbox Code Playgroud) xamarin.android xamarin maui maui-community-toolkit .net-maui.shell