Skip to content

Instantly share code, notes, and snippets.

@julesx
Created April 21, 2017 16:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save julesx/cabc17fe731f79126fb26763461ae32c to your computer and use it in GitHub Desktop.
Save julesx/cabc17fe731f79126fb26763461ae32c to your computer and use it in GitHub Desktop.
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class PickerListCell
{
public PickerListCell()
{
InitializeComponent();
MyPicker.Unfocused += MyPicker_Unfocused;
}
private void MyPicker_Unfocused(object sender, FocusEventArgs e)
{
_pickerListViewModel.ResetPicker();
ForceUpdateSize();
}
private void TapGestureRecognizer_OnTapped(object sender, EventArgs e)
{
MyPicker.Focus();
}
private PickerListFieldViewModel _pickerListViewModel;
protected override void OnBindingContextChanged()
{
base.OnBindingContextChanged();
if (BindingContext != null)
{
_pickerListViewModel = (PickerListFieldViewModel)BindingContext;
_pickerListViewModel.SelectedItems.CollectionChanged += SelectedItemsOnCollectionChanged;
}
}
private void SelectedItemsOnCollectionChanged(object sender, NotifyCollectionChangedEventArgs notifyCollectionChangedEventArgs)
{
//MessagingCenter.Send(_pickerListViewModel, "ForceLayout");
}
protected override void OnDisappearing()
{
_pickerListViewModel.SelectedItems.CollectionChanged -= SelectedItemsOnCollectionChanged;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment