Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

How to bind text to entry in xamarin forms

$
0
0

Hi, How to bind text to entry in xamarin forms my xaml is like

<controls:XfxComboBox Placeholder="Enter Text"
                      SelectedItem="{Binding SelectedItem}"
                      ItemsSource="{Binding Suggestions}"
                      SortingAlgorithm="{Binding SortingAlgorithm}"/>
    <Entry Text="{Binding Id}" Placeholder="Id"/>
   <Entry Text="{Binding Type}" Placeholder="Type"/>

and in my .cs BindingContext = new ServiceViewModel(); and my service model is like

 public class ServiceViewModel : BindableObject
    {
    public ServiceViewModel ()
     {
      .....
      ......
     Id = SelectedItem.id;
     }
        public string Id
        {
            get { return (string)GetValue(idProperty); }
            set { SetValue(idProperty, value); }
        }
      public static readonly BindableProperty idProperty = BindableProperty.Create(nameof(Id),
            typeof(string),
            typeof(MainPage),
            default(string),
            propertyChanged: OnPropertyChanged);

     private static void OnPropertyChanged(BindableObject bindable, object oldvalue, object newvalue)
        {
            var model = (ServiceViewModel)bindable;
        }
}

Id is not showing in Entry.What I'm doing wrong please help me.Thank you


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>