예제 #1
0
        public static void OnColumnsFilterChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            ListViewEx lv = (ListViewEx)sender;

            if (lv.ColumnFilters != null)
            {
                ListViewColumnUtils.UpdateFilterPanel(lv, lv.Columns, lv.ColumnFilters);
            }
        }
예제 #2
0
        public static void OnViewModeChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            ListViewEx fl = (ListViewEx)sender;

            if (args.NewValue == args.OldValue)
            {
                return;
            }
            //Debug.WriteLine(args.NewValue);
            ViewBase view = fl.View;

            if (args.Property.Equals(ViewModeProperty))
            {
                string viewMode = (string)args.NewValue;
                if (String.IsNullOrEmpty(viewMode))
                {
                    return;
                }
                string viewResourceName = viewMode + "View";
                view = (ViewBase)(fl.TryFindResource(viewResourceName));
                if (view != null)
                {
                    fl.View = view;
                }
                else
                {
                    Debug.WriteLine(String.Format("ListViewEx - {0} not found.", viewResourceName));
                }
            }

            if (fl.View != null)
            {
                //Only update columns if View is updated
                if (args.Property.Equals(ColumnsProperty) || args.Property.Equals(ViewModeProperty))
                {
                    ListViewColumnUtils.UpdateColumn(fl, fl.Columns);
                    fl.Dispatcher.Invoke(() =>
                    {
                        ListViewColumnUtils.UpdateFilterPanel(fl, fl.Columns, fl.ColumnFilters);
                    },
                                         System.Windows.Threading.DispatcherPriority.Input);
                }

                ////always update sort column
                ColumnInfo sortColumn = fl.Columns.Find(fl.SortBy);
                if (sortColumn != null)
                {
                    ListViewColumnUtils.UpdateSortSymbol(fl, sortColumn, fl.SortDirection);
                }
            }
            else
            {
                Debug.WriteLine(String.Format("ListViewEx - No view defined."));
            }
        }
예제 #3
0
        public void OnLoaded()
        {
            ListViewColumnUtils.RegisterFilterEvent(this);
            ListViewColumnUtils.UpdateFilterPanel(this, Columns, ColumnFilters);
            ColumnInfo sortColumn = Columns.Find(SortBy);

            if (sortColumn != null)
            {
                ListViewColumnUtils.UpdateSortSymbol(this, sortColumn, SortDirection);
            }
        }