コード例 #1
0
        private static void OnDataContextChanged(SearchListView view, object sender, DependencyPropertyChangedEventArgs args)
        {
            var dc = args.NewValue as SearchListViewModel;
            if (dc == null)
                return;

            var selectedChangedListener = 
                new WeakEventListener<SearchListView, SearchListViewModel, SelectedChangedEventArgs>(view, dc);
            dc.SelectedChanged += selectedChangedListener.OnEvent;
            selectedChangedListener.OnEventAction = OnSelectedChanged;
            selectedChangedListener.OnDetachAction = OnDetachSelectedChanged;
        }
コード例 #2
0
 private static void OnDetachDataContextChanged(WeakEventListener<SearchListView, SearchListView, DependencyPropertyChangedEventArgs> listener, SearchListView source)
 {
     source.DataContextChanged -= listener.OnEvent;
 }
コード例 #3
0
 private static void OnSelectedChanged(SearchListView view, object sender, SelectedChangedEventArgs args)
 {
     if (args.IsSelected)
         view.SearchList.Rebind();
 }