簡體   English   中英

Xamarin.Forms ListView自定義單元格不可選

[英]Xamarin.Forms ListView custom cell is not selectable

我創建了一個自定義單元格

public class TextCell2 : ViewCell
{
    public TextCell2()
    {
        View = new StackLayout
        {
            Orientation = StackOrientation.Horizontal,
            HorizontalOptions = LayoutOptions.FillAndExpand,
            Children =
            {
                new Label
                {
                    Text = "Test"
                },
                new Button
                {
                    Text = "Test 2"
                }
            }
        };
    }
}

如果我不添加任何孩子,則可以選擇該單元格。 如果我添加任何子項,則無法再選擇該單元格。

PLZ幫助我如何在自定義視圖中使用選擇。

將InputTransparent = true設置為標簽和按鈕。

他們目前正在抓住點擊。 InputTransparent將讓點擊進入父元素。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM