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

huangapple go评论56阅读模式
英文:

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&gt>
                   
                 <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&gt>
                                                                        
                                        <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"/&gt>

                                            </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&#39;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&#39;m trying to do.

[![enter image description here][1]][1]

here is the code.

   

    &lt;VerticalStackLayout  BackgroundColor=&quot;{StaticResource 00dp}&quot;  BindableLayout.ItemsSource=&quot;{Binding inspectionData.inspectionSection}&quot;&gt;
    &lt;BindableLayout.ItemTemplate&gt;
        &lt;DataTemplate&gt;    
			&lt;VerticalStackLayout &gt;			         
                &lt;Border  Margin=&quot;10,20,10,10&quot; Padding=&quot;0&quot; BackgroundColor=&quot;{StaticResource 02dp}&quot; Grid.Row=&quot;0&quot; Style=&quot;{StaticResource roundedBorderStyleGray}&quot; &gt;
                                            &lt;VerticalStackLayout&gt;
                    &lt;HorizontalStackLayout &gt;
                        &lt;Label FontFamily=&quot;OpenSansSemiBold&quot; Margin=&quot;15,20,10,10&quot; Text=&quot;{Binding title}&quot;  TextColor=&quot;{StaticResource TrackemOrange}&quot;/&gt;                         
                    &lt;/HorizontalStackLayout&gt;
                       
                     &lt;VerticalStackLayout  BindableLayout.ItemsSource=&quot;{Binding inspectionQuestion}&quot;&gt;
                        &lt;BindableLayout.ItemTemplate&gt;
                            &lt;DataTemplate&gt;
                                 &lt;VerticalStackLayout&gt;
                                    &lt;Border Margin=&quot;10,0,10,10&quot; Padding=&quot;5,5,5,5&quot; BackgroundColor=&quot;{StaticResource 00dp}&quot; Grid.Row=&quot;0&quot; Style=&quot;{StaticResource roundedBorderStyleBlack}&quot; &gt;
                                    
                                        &lt;VerticalStackLayout   &gt;
                                            &lt;HorizontalStackLayout Padding=&quot;15,15,0,10&quot; &gt;
                                                &lt;Label FontFamily=&quot;OpenSansSemiBold&quot; Margin=&quot;0,3,0,0&quot; FontSize=&quot;14&quot;   Text=&quot;Q: &quot;  TextColor=&quot;White&quot;/&gt;
                                                &lt;Label Padding=&quot;15,3,0,10&quot; FontFamily=&quot;OpenSansRegular&quot;  Text=&quot;{Binding questionText}&quot; TextColor=&quot;#FFFFFF&quot;/&gt;
                                            &lt;/HorizontalStackLayout&gt;
                                                                            
                                            &lt;BoxView   Background=&quot;#2D2D30&quot; HeightRequest=&quot;1&quot; /&gt;

                                            &lt;VerticalStackLayout Padding=&quot;0,15,0,10&quot; IsVisible=&quot;{Binding isShowText}&quot;&gt;
                                                &lt;Frame HasShadow=&quot;False&quot;  BorderColor=&quot;#2D2D30&quot; Background=&quot;transparent&quot; Padding=&quot;0&quot; Margin=&quot;15,0,15,0&quot;&gt;

                                                    &lt;commonviews:BorderlessTextEntry  Text=&quot;{Binding answerText}&quot;  HeightRequest=&quot;40&quot; PlaceholderColor=&quot;{StaticResource TrackemDisabled}&quot;  Placeholder=&quot;Answer&quot; TextColor=&quot;{StaticResource TrackemWhite}&quot; BackgroundColor=&quot;Transparent&quot;  VerticalOptions=&quot;Start&quot;/&gt;
                                                &lt;/Frame&gt;
                                            &lt;/VerticalStackLayout&gt;

                                            &lt;VerticalStackLayout Padding=&quot;0,15,0,10&quot; IsVisible=&quot;{Binding allowComment}&quot;&gt;

                                                &lt;Frame HasShadow=&quot;False&quot;  BorderColor=&quot;#2D2D30&quot; Background=&quot;transparent&quot; Padding=&quot;0&quot; Margin=&quot;15,0,15,0&quot; &gt;

                                                    &lt;commonviews:BorderlessTextEntry  Text=&quot;{Binding comment}&quot;  HeightRequest=&quot;40&quot;  Placeholder=&quot;Comment&quot; PlaceholderColor=&quot;{StaticResource TrackemDisabled}&quot; TextColor=&quot;{StaticResource TrackemWhite}&quot; BackgroundColor=&quot;Transparent&quot;  VerticalOptions=&quot;Start&quot;/&gt;

                                                &lt;/Frame&gt;

                                            &lt;/VerticalStackLayout&gt;            
                                        &lt;/VerticalStackLayout&gt;

                                     &lt;/Border&gt;


                                 &lt;/VerticalStackLayout&gt;
                                                    
                             &lt;/DataTemplate&gt;
                        &lt;/BindableLayout.ItemTemplate&gt;

                     &lt;/VerticalStackLayout&gt;                    


                      &lt;/VerticalStackLayout&gt;
                &lt;/Border&gt;		                
			&lt;/VerticalStackLayout&gt;
				               
		&lt;/DataTemplate&gt;
	&lt;/BindableLayout.ItemTemplate&gt;

&lt;/VerticalStackLayout&gt;

not sure, what i did wrong here. can someone please help me here. it&#39;s working as expected in android.


  [1]: https://i.stack.imgur.com/mNwfw.png

</details>


# 答案1
**得分**: 1

从第二行开始,这里的关键点是:

在`ItemTemplate`上的`&lt;VerticalStackLayout VerticalOptions=&quot;FillAndExpand&quot;&gt;`。

你告诉**每个项目**尝试占据整个高度。这可能不是一个好主意。

* 移除`VerticalOptions`。

<details>
<summary>英文:</summary>

**from second row** is the essential point here.

`&lt;VerticalStackLayout VerticalOptions=&quot;FillAndExpand&quot;&gt;` on `ItemTemplate.`

You tell **each item** to try to take the entire height. That can&#39;t be a good idea.

* Remove `VerticalOptions`.

</details>



huangapple
  • 本文由 发表于 2023年5月24日 21:01:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/76323839.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定