英文:
I'm not able to focus on any entry and not able to click on any checkbox/radio button inside bindable stack layout in iOS .net maui
问题
以下是您要翻译的内容:
"I'm not able to focus on any entry and not able to click on any checkbox/radio button inside bindable stack layout from second row in .net maui for iOS. android is working fine.
here is the screenshot of what i'm trying to do.
[![enter image description here][1]][1]
here is the code.
<VerticalStackLayout BackgroundColor="{StaticResource 00dp}" BindableLayout.ItemsSource="{Binding inspectionData.inspectionSection}">
<BindableLayout.ItemTemplate>
<DataTemplate>
<VerticalStackLayout >
<Border Margin="10,20,10,10" Padding="0" BackgroundColor="{StaticResource 02dp}" Grid.Row="0" Style="{StaticResource roundedBorderStyleGray}" >
<VerticalStackLayout>
<HorizontalStackLayout >
<Label FontFamily="OpenSansSemiBold" Margin="15,20,10,10" Text="{Binding title}" TextColor="{StaticResource TrackemOrange}"/>
</HorizontalStackLayout>>
<VerticalStackLayout BindableLayout.ItemsSource="{Binding inspectionQuestion}">
<BindableLayout.ItemTemplate>
<DataTemplate>
<VerticalStackLayout>
<Border Margin="10,0,10,10" Padding="5,5,5,5" BackgroundColor="{StaticResource 00dp}" Grid.Row="0" Style="{StaticResource roundedBorderStyleBlack}" >
<VerticalStackLayout >
<HorizontalStackLayout Padding="15,15,0,10" >
<Label FontFamily="OpenSansSemiBold" Margin="0,3,0,0" FontSize="14" Text="Q: " TextColor="White"/>
<Label Padding="15,3,0,10" FontFamily="OpenSansRegular" Text="{Binding questionText}" TextColor="#FFFFFF"/>
</HorizontalStackLayout>>
<BoxView Background="#2D2D30" HeightRequest="1" />
<VerticalStackLayout Padding="0,15,0,10" IsVisible="{Binding isShowText}">
<Frame HasShadow="False" BorderColor="#2D2D30" Background="transparent" Padding="0" Margin="15,0,15,0">
<commonviews:BorderlessTextEntry Text="{Binding answerText}" HeightRequest="40" PlaceholderColor="{StaticResource TrackemDisabled}" Placeholder="Answer" TextColor="{StaticResource TrackemWhite}" BackgroundColor="Transparent" VerticalOptions="Start"/>
</Frame>
</VerticalStackLayout>
<VerticalStackLayout Padding="0,15,0,10" IsVisible="{Binding allowComment}">
<Frame HasShadow="False" BorderColor="#2D2D30" Background="transparent" Padding="0" Margin="15,0,15,0" >
<commonviews:BorderlessTextEntry Text="{Binding comment}" HeightRequest="40" Placeholder="Comment" PlaceholderColor="{StaticResource TrackemDisabled}" TextColor="{StaticResource TrackemWhite}" BackgroundColor="Transparent" VerticalOptions="Start"/>>
</Frame>
</VerticalStackLayout>
</VerticalStackLayout>
</Border>
</VerticalStackLayout>
</DataTemplate>
</BindableLayout.ItemTemplate>
</VerticalStackLayout>
</VerticalStackLayout>
</Border>
</VerticalStackLayout>
</DataTemplate>
</BindableLayout.ItemTemplate>
</VerticalStackLayout>
not sure, what i did wrong here. can someone please help me here. it's working as expected in android.
[1]: https://i.stack.imgur.com/mNwfw.png"
请注意,代码部分不会进行翻译。如果您需要进一步的帮助,请告诉我。
<details>
<summary>英文:</summary>
I'm not able to focus on any entry and not able to click on any checkbox/radio button inside bindable stack layout from second row in .net maui for iOS. android is working fine.
here is the screenshot of what i'm trying to do.
[![enter image description here][1]][1]
here is the code.
<VerticalStackLayout BackgroundColor="{StaticResource 00dp}" BindableLayout.ItemsSource="{Binding inspectionData.inspectionSection}">
<BindableLayout.ItemTemplate>
<DataTemplate>
<VerticalStackLayout >
<Border Margin="10,20,10,10" Padding="0" BackgroundColor="{StaticResource 02dp}" Grid.Row="0" Style="{StaticResource roundedBorderStyleGray}" >
<VerticalStackLayout>
<HorizontalStackLayout >
<Label FontFamily="OpenSansSemiBold" Margin="15,20,10,10" Text="{Binding title}" TextColor="{StaticResource TrackemOrange}"/>
</HorizontalStackLayout>
<VerticalStackLayout BindableLayout.ItemsSource="{Binding inspectionQuestion}">
<BindableLayout.ItemTemplate>
<DataTemplate>
<VerticalStackLayout>
<Border Margin="10,0,10,10" Padding="5,5,5,5" BackgroundColor="{StaticResource 00dp}" Grid.Row="0" Style="{StaticResource roundedBorderStyleBlack}" >
<VerticalStackLayout >
<HorizontalStackLayout Padding="15,15,0,10" >
<Label FontFamily="OpenSansSemiBold" Margin="0,3,0,0" FontSize="14" Text="Q: " TextColor="White"/>
<Label Padding="15,3,0,10" FontFamily="OpenSansRegular" Text="{Binding questionText}" TextColor="#FFFFFF"/>
</HorizontalStackLayout>
<BoxView Background="#2D2D30" HeightRequest="1" />
<VerticalStackLayout Padding="0,15,0,10" IsVisible="{Binding isShowText}">
<Frame HasShadow="False" BorderColor="#2D2D30" Background="transparent" Padding="0" Margin="15,0,15,0">
<commonviews:BorderlessTextEntry Text="{Binding answerText}" HeightRequest="40" PlaceholderColor="{StaticResource TrackemDisabled}" Placeholder="Answer" TextColor="{StaticResource TrackemWhite}" BackgroundColor="Transparent" VerticalOptions="Start"/>
</Frame>
</VerticalStackLayout>
<VerticalStackLayout Padding="0,15,0,10" IsVisible="{Binding allowComment}">
<Frame HasShadow="False" BorderColor="#2D2D30" Background="transparent" Padding="0" Margin="15,0,15,0" >
<commonviews:BorderlessTextEntry Text="{Binding comment}" HeightRequest="40" Placeholder="Comment" PlaceholderColor="{StaticResource TrackemDisabled}" TextColor="{StaticResource TrackemWhite}" BackgroundColor="Transparent" VerticalOptions="Start"/>
</Frame>
</VerticalStackLayout>
</VerticalStackLayout>
</Border>
</VerticalStackLayout>
</DataTemplate>
</BindableLayout.ItemTemplate>
</VerticalStackLayout>
</VerticalStackLayout>
</Border>
</VerticalStackLayout>
</DataTemplate>
</BindableLayout.ItemTemplate>
</VerticalStackLayout>
not sure, what i did wrong here. can someone please help me here. it's working as expected in android.
[1]: https://i.stack.imgur.com/mNwfw.png
</details>
# 答案1
**得分**: 1
从第二行开始,这里的关键点是:
在`ItemTemplate`上的`<VerticalStackLayout VerticalOptions="FillAndExpand">`。
你告诉**每个项目**尝试占据整个高度。这可能不是一个好主意。
* 移除`VerticalOptions`。
<details>
<summary>英文:</summary>
**from second row** is the essential point here.
`<VerticalStackLayout VerticalOptions="FillAndExpand">` on `ItemTemplate.`
You tell **each item** to try to take the entire height. That can't be a good idea.
* Remove `VerticalOptions`.
</details>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论