Share the content of Edit in different cards of TabView

Paolo Mossa 161 Reputation points
2022-04-28T16:22:40.193+00:00

Hi to All. I have two Edit controls in an Xaml file that must share the same text.

Below the partials codes of the TabView:

<xct:TabView>
<xct:TabViewItem Text="Grafici" BackgroundColor="AntiqueWhite" HeightRequest="35" TextColorSelected="LimeGreen">
<xct:TabViewItem.Content>
<StackLayout Margin="0,0,0,0">
<Editor x:Name="editable" IsVisible="False" BackgroundColor="Aquamarine" HeightRequest="100" Keyboard="Plain" />

<xct:TabViewItem  Text="Testo" BackgroundColor="BlanchedAlmond" HeightRequest="35" TextColorSelected="LimeGreen">
        <xct:TabViewItem.Content>
            <StackLayout>
                <Editor x:Name="testogood" IsVisible="True" BackgroundColor="Aquamarine" HeightRequest="900" Keyboard="Plain"/>

How can I do it?
Thanks in advanced for any reply

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,296 questions
0 comments No comments
{count} votes

Accepted answer
  1. Rob Caplan - MSFT 5,412 Reputation points Microsoft Employee
    2022-04-28T22:58:59.287+00:00

    Hi Paulo,

    I redirected your three threads to the same one as they are all basically the same question with the same answer.

    To connect the data displayed in two controls one can "Data Bind" the controls together. This can be done directly (Control X binds to Control Y), but more commonly we separate out the data from the presentation: create a backing class with the data we want the controls to show and then bind both controls to that data.

    To get started on Data Binding see the documentation starting at Xamarin.Forms / App Fundamentals / Data Binding

    0 comments No comments

0 additional answers

Sort by: Most helpful