Issue
I am using a BindableLayout and inside that, I am displaying a list of items
<StackLayout
BindableLayout.ItemsSource="{Binding AccountsList}" Spacing="0">
<BindableLayout.ItemTemplate>
<DataTemplate>
<Frame
Margin="0,5,0,10"
Padding="10">
<Label Text="testinnnng"/>
<Entry Text="{Binding UserText}"/>//this entry is not allowing the user to click on the UI since it is inside the list item
</Frame>
</DataTemplate>
</BindableLayout.ItemTemplate>
</StackLayout>
Here each frame is one list item. The issue is inside the list item I have an entry box. But I am not able to edit the text. I tried all possible solutions given in google but still, the entry is not editable. I request please anybody help me on this issue in xamarin forms.
Thank you
Solution
Like Jason said, the xaml is invalid. Put the stacklayout inside the frame first.
Xaml:
<StackLayout BindableLayout.ItemsSource="{Binding AccountsList}" Spacing="0">
<BindableLayout.ItemTemplate>
<DataTemplate>
<Frame Margin="0,5,0,10" Padding="10">
<StackLayout>
<Label Text="testinnnng" />
<Entry Text="{Binding UserText}" />
</StackLayout>
</Frame>
</DataTemplate>
</BindableLayout.ItemTemplate>
</StackLayout>
Code behind:
public partial class Page2 : ContentPage
{
public ObservableCollection<Info> AccountsList { get; set; }
public Page2()
{
InitializeComponent();
AccountsList = new ObservableCollection<Info>()
{
new Info(){ UserText="A"},
new Info(){ UserText="B"},
new Info(){ UserText="C"},
new Info(){ UserText="D"},
};
this.BindingContext = this;
}
}
public class Info
{
public string UserText { get; set; }
}
The entry could be edited now.
Answered By - Wendy Zang - MSFT
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.