Created
April 21, 2017 16:53
-
-
Save julesx/cabc17fe731f79126fb26763461ae32c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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