protected override void OnSourceChanged(ListViewBaseSource oldSource, ListViewBaseSource newSource) { base.OnSourceChanged(oldSource, newSource); var asGridViewSource = newSource as GridViewSource; if (asGridViewSource != null) { Layout.Source = new WeakReference <ListViewBaseSource>(asGridViewSource); } }
protected virtual void OnSourceChanged(ListViewBaseSource oldSource, ListViewBaseSource newSource) { if (oldSource != null) { oldSource.SelectionChanged -= OnRouteSelectionChanged; } if (newSource != null) { newSource.Items = ItemsSource as IEnumerable; newSource.ItemClickCommand = Command; newSource.SelectionMode = SelectionMode; newSource.SelectionChanged += OnRouteSelectionChanged; newSource.ItemClick += (s2, e) => ItemClick?.Invoke(s2, e); } }