- Home
- Forum
- Xamarin.Forms
- How to retrieve .Text value from Entry control on PopupView.ContentTemplate
How to retrieve .Text value from Entry control on PopupView.ContentTemplate
Good afternoon, how can I get the value that I enter in the popup in this example:
for Text1
<sfPopup:SfPopupLayout.PopupView>
<sfPopup:PopupView AnimationMode="Zoom" AppearanceMode="TwoButton" AcceptButtonText="Guardar" DeclineButtonText="Cancelar">
<sfPopup:PopupView.ContentTemplate>
<DataTemplate>
<ScrollView>
<StackLayout BackgroundColor="#F5F6F6">
<Frame x:Name="frame1" CornerRadius="7" Margin="10,10,10,0">
<Grid>
<Label Grid.Column="0" Grid.Row="0" Text="Text1" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" TextColor="Black" FontAttributes="Bold"/>
<Label Grid.Column="1" Grid.Row="0" Text="Text2" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" TextColor="Black" FontAttributes="Bold"/>
<Label Grid.Column="2" Grid.Row="0" Text="Text3" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" TextColor="Black" FontAttributes="Bold"/>
<Label Grid.Column="0" Grid.Row="1" x:Name="txt_1" Text="{Binding Text1}" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" TextColor="Black" FontAttributes="Bold"/>
<Label Grid.Column="1" Grid.Row="1" Text="{Binding Text2}" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" TextColor="Black" FontAttributes="Bold"/>
<Label Grid.Column="2" Grid.Row="1" Text="{Binding Text3}" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" TextColor="Black" FontAttributes="Bold"/>
</Grid>
</Frame>
</StackLayout>
</ScrollView>
</DataTemplate>
</sfPopup:PopupView.ContentTemplate>
</sfPopup:PopupView>
</sfPopup:SfPopupLayout.PopupView>
SIGN IN To post a reply.
3 Replies
1 reply marked as answer
PK
Pradeep Kumar Balakrishnan
Syncfusion Team
January 19, 2021 11:31 AM UTC
Hi David,
Thank you for contacting Syncfusion support.
We have checked your requirement “How to access the modified value in Popup content template in Xamarin forms”. We cannot access the view which is loaded inside the DataTemplate. However, your requirement can be achieved by accessing binding context value in SfPopupLayout closed event. Refer the following code snippet for reference.
Code snippet:
|
private void popupLayout_Closed(object sender, EventArgs e)
{
var bindingContext = this.popupLayout.PopupView.BindingContext as Model;
var modifiedVlaue = bindingContext.EntryText;
var text1 = bindingContext.Text1;
} |
We have also attached sample for your reference in the following link
Let us know if you need any further assistance on this.
Regards,
Pradeep Kumar B
Marked as answer
DA
David
January 19, 2021 05:00 PM UTC
Thank you very much, it worked perfectly.
PK
Pradeep Kumar Balakrishnan
Syncfusion Team
January 20, 2021 05:41 AM UTC
Hi David,
Thank you for the update. We glad to know that your requirement is achieved.
Regards,
Pradeep Kumar B
SIGN IN To post a reply.