Exemple #1
0
        protected virtual void OnSheetChanged(IRelationalSheet oldValue, IRelationalSheet newValue)
        {
            this.Columns.Clear();

            if (newValue != null)
            {
                var keyPath = newValue.Header.Variant == 1 ? "Key" : "FullKey";

                //prevent multiple enumeration
                var columns = newValue.Header.Columns.ToList();

                ColumnSetToRaw = new bool[columns.Count];

                Columns.Add(new RawDataGridKeyColumn(keyPath)
                {
                    CanUserSort = true
                });

                foreach (var col in columns)
                {
                    Columns.Add(ColumnFactory.Create(col));
                }

                var source = new RawDataItemsSource(newValue);
                if (Filter != null)
                {
                    source.Filter = o => FilterMatch(o, Filter);
                }
                this.ItemsSource = source;
            }
            else
            {
                this.ItemsSource = null;
            }
        }
Exemple #2
0
        protected virtual void OnSheetChanged(IRelationalSheet oldValue, IRelationalSheet newValue)
        {
            this.Columns.Clear();

            if (newValue != null)
            {
                var keyPath = newValue.Header.Variant == 1 ? "Key" : "FullKey";

                //prevent multiple enumeration
                var columns = newValue.Header.Columns.ToList();

                if (Settings.Default.SortByOffsets)
                {
                    columns.Sort((x, y) => x.Offset.CompareTo(y.Offset));
                }

                ColumnSetToRaw = new bool[columns.Count];

                Columns.Add(new RawDataGridKeyColumn(keyPath)
                {
                    CanUserSort = true
                });

                foreach (var col in columns)
                {
                    Columns.Add(ColumnFactory.Create(col));
                }

                var source = new RawDataItemsSource(newValue);
                if (!string.IsNullOrWhiteSpace(Filter))
                {
                    source.Filter = Filter;
                }
                this.ItemsSource = source;
            }
            else
            {
                this.ItemsSource = null;
            }
        }