title: Xamarin forms custom view dropdown is not working
body: <p>I’m trying to make a custom drop-down in xamarin forms with some bindable properties. I’m having a label and a list view below the label using relative layout so that listview will always below the label and its IsVisible property will be toggled.</p>
  
  <p>I have created a custom view as below:</p>
  
  <p><strong>Dropdown.xaml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;ContentView xmlns="http://xamarin.com/schemas/2014/forms" 
           xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
           x:Class="CustomViewXam.CustomViews.Dropdown"&gt;
  
    &lt;StackLayout&gt;
      &lt;RelativeLayout&gt;
  
          &lt;Label x:Name="selectedLabel" TextColor="Red" Text="xcx"
                   BackgroundColor="Silver" FontSize="15" 
                   HeightRequest="50"
                   RelativeLayout.WidthConstraint =
                   "{ConstraintExpression
                   Type=RelativeToParent,
                   Property=Width,
                   Factor=0.5,
                   Constant=0}"/&gt;
  
          &lt;ListView x:Name="listView" BackgroundColor="Black" 
  
                             RelativeLayout.WidthConstraint =
                   "{ConstraintExpression
                   Type=RelativeToView,
                   ElementName=selectedLabel,
                   Property=Width,
                   Factor=1,
                   Constant=0}"
  
                             RelativeLayout.YConstraint=
                   "{ConstraintExpression
                   Type=RelativeToView,
                   ElementName=selectedLabel,
                   Property=Height,
                   Factor=1,
                   Constant=0}"
                   &gt;
          &lt;/ListView&gt;            
       &lt;/RelativeLayout&gt;
     &lt;/StackLayout&gt;
   &lt;/ContentView&gt;
  </code></pre>
  
  <p><strong>Dropdown.xaml.cs</strong></p>
  
  <pre><code> public partial class Dropdown : ContentView
  {
      public Dropdown()
      {
          InitializeComponent();
          BindingContext = this;
      }
  
      public string TitleText
      {
          get { return base.GetValue(TitleTextProperty).ToString(); }
          set { base.SetValue(TitleTextProperty, value); }
      }
  
      private static BindableProperty TitleTextProperty = BindableProperty.Create(
          propertyName: "TitleText",
          returnType: typeof(string),
          declaringType: typeof(string),
          defaultValue: "",
          defaultBindingMode: BindingMode.TwoWay,
          propertyChanged: TitleTextPropertyChanged);
  
      private static void TitleTextPropertyChanged(BindableObject bindable, object oldValue, object newValue)
      {
          var control = (Dropdown)bindable;
          control.selectedLabel.Text = newValue.ToString();
      }
  
      public static readonly BindableProperty ItemsSourceProperty =
          BindableProperty.Create&lt;Dropdown, IEnumerable&lt;object&gt;&gt;(p =&gt; p.ItemsSource,
                                                                 null, BindingMode.OneWay, null, (bindable, oldValue, newValue) =&gt; { ((Dropdown)bindable).LoadItems(newValue); });
  
  
      public IEnumerable&lt;object&gt; ItemsSource
      {
          get { return (IEnumerable&lt;object&gt;)GetValue(ItemsSourceProperty); }
          set { SetValue(ItemsSourceProperty, value); }
      }
  
  
      public void LoadItems(IEnumerable&lt;object&gt; tiles)
      {
          try
          {
              var list = tiles;
          }
          catch (Exception e)
          { // can throw exceptions if binding upon disposal
          }
  
      }
  }
  </code></pre>
  
  <p>And I'm using this custom view as below in my xaml page</p>
  
  <pre><code>  &lt;local:Dropdown TitleText="dssdasd"  ItemsSource="{Binding TitleList}" /&gt;
  </code></pre>
  
  <p>Where TitleList is an ObservableCollection in ViewModel</p>
  
  <pre><code>private ObservableCollection&lt;string&gt; _titleList;  
      public ObservableCollection&lt;string&gt; TitleList
      {  
          get  
          {  
              return _titleList;  
          }  
          set  
          {  
              if (_titleList!= value)  
              {  
                  _titleList= value;  
                  NotifyPropertyChanged("TitleList");  
              }  
          }  
      }  
  </code></pre>
  
  <p><strong>Problem:</strong></p>
  
  <p>The Text is visible on the UI and text is coming properly, but the listview below is empty and data is not coming. <strong>LoadItems</strong> method in Custom dropdown is not getting called even <strong>TitleList</strong> list is updated. Can anyone please guide me whats wrong i'm doing in the above code.</p>
  
  <p><strong>Note:</strong> I'm having BindingContext set to my view model in my view. </p>