示例#1
0
        protected virtual void HandleViewModelPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "SortType")
            {
                /* Hack to make it actually resort */
                sort?.SetSortFunc(COL_DATA, HandleSort);
            }

            if (e.PropertyName == "FilterText")
            {
                filter?.Refilter();
            }

            if (e.PropertyName == "Collection_" + nameof(viewModel.Selection))
            {
                //Sincronization of the first external selection
                if (ViewModel.Selection.Count == 1 && Selection.CountSelectedRows() == 0)
                {
                    foreach (TreeIter element in dictionaryStore[ViewModel.Selection.FirstOrDefault()])
                    {
                        TreeIter externalSelected = element;
                        if (filter != null)
                        {
                            externalSelected = filter.ConvertChildIterToIter(externalSelected);
                            externalSelected = sort.ConvertChildIterToIter(externalSelected);
                        }
                        Selection.SelectIter(externalSelected);
                    }
                }
            }
        }