Handles synchronization of ListViewExtensions.BindableSelection to a ListView.
Пример #1
0
        /// <summary>
        /// Handles changes to the BindableSelection property.
        /// </summary>
        /// <param name="d">
        /// The <see cref="DependencyObject"/> on which
        /// the property has changed value.
        /// </param>
        /// <param name="e">
        /// Event data that is issued by any event that
        /// tracks changes to the effective value of this property.
        /// </param>
        private static void OnBindableSelectionChanged(
            DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ObservableCollection<object> oldBindableSelection = (ObservableCollection<object>)e.OldValue;
            ObservableCollection<object> newBindableSelection = (ObservableCollection<object>)d.GetValue(BindableSelectionProperty);

            if (oldBindableSelection != null)
            {
                var handler = GetBindableSelectionHandler(d);
                SetBindableSelectionHandler(d, null);
                handler.Detach();
            }

            if (newBindableSelection != null)
            {
                var handler = new ListViewBindableSelectionHandler((ListViewBase)d, newBindableSelection);
                SetBindableSelectionHandler(d, handler);
            }
        }
Пример #2
0
        /// <summary>
        /// Handles changes to the BindableSelection property.
        /// </summary>
        /// <param name="d">
        /// The <see cref="DependencyObject"/> on which
        /// the property has changed value.
        /// </param>
        /// <param name="e">
        /// Event data that is issued by any event that
        /// tracks changes to the effective value of this property.
        /// </param>
        private static void OnBindableSelectionChanged(
            DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ObservableCollection <object> oldBindableSelection = (ObservableCollection <object>)e.OldValue;
            ObservableCollection <object> newBindableSelection = (ObservableCollection <object>)d.GetValue(BindableSelectionProperty);

            if (oldBindableSelection != null)
            {
                var handler = GetBindableSelectionHandler(d);
                SetBindableSelectionHandler(d, null);
                handler.Detach();
            }

            if (newBindableSelection != null)
            {
                var handler = new ListViewBindableSelectionHandler((ListViewBase)d, newBindableSelection);
                SetBindableSelectionHandler(d, handler);
            }
        }
Пример #3
0
        /// <summary>
        /// Handles changes to the BindableSelection property.
        /// </summary>
        /// <param name="d">
        /// The <see cref="DependencyObject"/> on which
        /// the property has changed value.
        /// </param>
        /// <param name="e">
        /// Event data that is issued by any event that
        /// tracks changes to the effective value of this property.
        /// </param>
        private static void OnBindableSelectionChanged(
            DependencyObject d,
            DependencyPropertyChangedEventArgs e)
        {
            dynamic oldBindableSelection = e.OldValue;
            dynamic newBindableSelection = d.GetValue(BindableSelectionProperty);

            if (oldBindableSelection != null)
            {
                var handler = GetBindableSelectionHandler(d);
                SetBindableSelectionHandler(d, null);
                handler.Detach();
            }
            if (newBindableSelection != null)
            {
                var handler = new ListViewBindableSelectionHandler(
                    (ListViewBase)d, newBindableSelection);
                SetBindableSelectionHandler(d, handler);
            }
        }
Пример #4
0
        /// <summary>
        /// Handles changes to the BindableSelection property.
        /// </summary>
        /// <param name="d">
        /// The <see cref="DependencyObject"/> on which
        /// the property has changed value.
        /// </param>
        /// <param name="e">
        /// Event data that is issued by any event that
        /// tracks changes to the effective value of this property.
        /// </param>
        private static void OnBindableSelectionChanged(
            DependencyObject d,
            DependencyPropertyChangedEventArgs e)
        {
            dynamic oldBindableSelection = e.OldValue;
            dynamic newBindableSelection = d.GetValue(BindableSelectionProperty);

            if (oldBindableSelection != null)
            {
                var handler = GetBindableSelectionHandler(d);
                SetBindableSelectionHandler(d, null);
                handler.Detach();
            }

            if (newBindableSelection != null)
            {
                var handler = new ListViewBindableSelectionHandler(
                    (ListViewBase)d, newBindableSelection);
                SetBindableSelectionHandler(d, handler);
            }
        }
 /// <summary>
 /// Sets the BindableSelectionHandler property. This dependency property
 /// indicates BindableSelectionHandler for a ListView - used to manage synchronization of BindableSelection and SelectedItems.
 /// </summary>
 public static void SetBindableSelectionHandler(
     DependencyObject d,
     ListViewBindableSelectionHandler value)
 {
     d.SetValue(BindableSelectionHandlerProperty, value);
 }
Пример #6
0
 /// <summary>
 /// Sets the BindableSelectionHandler property. This dependency property 
 /// indicates BindableSelectionHandler for a ListView - used to manage synchronization of BindableSelection and SelectedItems.
 /// </summary>
 public static void SetBindableSelectionHandler(
     DependencyObject d,
     ListViewBindableSelectionHandler value)
 {
     d.SetValue(BindableSelectionHandlerProperty, value);
 }