This commit is contained in:
Pavel Yakovlev 2018-08-07 18:13:10 +03:00 коммит произвёл Rui Marinho
Родитель baf4a30199
Коммит c7bb53cd82
1 изменённых файлов: 18 добавлений и 7 удалений

Просмотреть файл

@ -44,7 +44,10 @@ namespace Xamarin.Forms.Platform.WPF
Style = (System.Windows.Style)System.Windows.Application.Current.Resources["ListViewTemplate"]
};
SetNativeControl(listView);
Control.SelectionChanged += OnNativeSelectionChanged;
Control.MouseUp += OnNativeMouseUp;
Control.KeyUp += OnNativeKeyUp;
Control.TouchUp += OnNativeTouchUp;
Control.StylusUp += OnNativeStylusUp;
}
// Update control property
@ -122,12 +125,17 @@ namespace Xamarin.Forms.Platform.WPF
}
}
void OnNativeKeyUp(object sender, KeyEventArgs e)
=> Element.NotifyRowTapped(Control.SelectedIndex, cell: null);
void OnNativeSelectionChanged(object sender, SelectionChangedEventArgs e)
{
Element.NotifyRowTapped(Control.SelectedIndex, cell:null);
}
void OnNativeMouseUp(object sender, MouseButtonEventArgs e)
=> Element.NotifyRowTapped(Control.SelectedIndex, cell: null);
void OnNativeTouchUp(object sender, TouchEventArgs e)
=> Element.NotifyRowTapped(Control.SelectedIndex, cell: null);
void OnNativeStylusUp(object sender, StylusEventArgs e)
=> Element.NotifyRowTapped(Control.SelectedIndex, cell: null);
bool _isDisposed;
@ -140,7 +148,10 @@ namespace Xamarin.Forms.Platform.WPF
{
if (Control != null)
{
Control.SelectionChanged -= OnNativeSelectionChanged;
Control.MouseUp -= OnNativeMouseUp;
Control.KeyUp -= OnNativeKeyUp;
Control.TouchUp -= OnNativeTouchUp;
Control.StylusUp -= OnNativeStylusUp;
}
if (Element != null)