Hi All,
I have created the usercontrol for Listview control. Used the below code in code behind for bind. it's working fine.
XAML page
<controls:UCListView x:Name="listview1"/>
.CS page
listview1.ListViewBind = ViewModel.Bindlistview1;
Now, I want to bind the control from View model page(Used MVVM Pattern). Tried below code but not working. kindly let me know anyone how to achieve this.
XAML page
<controls:UCListView x:Name="listview1" ItemsSource="{Binding Bindlistview1,Mode=TwoWay}"/>
User Control page code
public UCListView()
{
try
{
InitializeComponent();
BindingContext = this;
}
catch
{
}
}
public static readonly BindableProperty ListSourceProperty =
BindableProperty.Create<UCListView, ObservableCollection<Helpdesk>>(p => p.ListViewBind, new ObservableCollection<Helpdesk>());
public ObservableCollection<Helpdesk> ListViewBind
{
get { return (ObservableCollection<Helpdesk>)GetValue(ListSourceProperty); }
set { SetValue(ListSourceProperty, value); }
}
Regards,
Ashwin C