Ejemplo n.º 1
0
        private void AddColumns(IEnumerable <IGridColumn> columns, int index = -1)
        {
            if (index == -1)
            {
                index = this.ComparisonGrid.Columns.Count;
            }

            foreach (var columnHeader in columns)
            {
                var column = new DataGridTemplateColumn();
                column.Header         = columnHeader;
                column.HeaderTemplate = _columnHeaderTemplate;
                column.CellTemplate   = StatComparisonDocumentView.CreateDataTemplateWrapper(_statValueTemplate, new Binding(string.Format("[{0}]", columnHeader.Key)));

                this.ComparisonGrid.Columns.Insert(index, column);
                ++index;
            }
        }
Ejemplo n.º 2
0
        private void ResetColumns()
        {
            this.ClearColumns();

            var rowHeaderBinding = new Binding(string.Format("[{0}]", StatComparisonDocumentVM.RowHeaderKey));

            var firstColumn = new DataGridTemplateColumn();

            firstColumn.CellTemplate = this.ViewModel.ColumnMode.Mode == ColumnMode.Stats
                                     ? StatComparisonDocumentView.CreateDataTemplateWrapper(_tankTemplate, rowHeaderBinding)
                                     : StatComparisonDocumentView.CreateDataTemplateWrapper(_statInfoTemplate, rowHeaderBinding);

            firstColumn.CanUserReorder = false;

            this.ComparisonGrid.Columns.Add(firstColumn);

            this.AddColumns(this.ViewModel.ColumnHeaders);
        }
        public override ICreateDocumentTask CreateCreateDocumentTask(Uri uri, Guid guid, string persistentInfo)
        {
            return(CreateDocumentTask.FromFactory(() =>
            {
                var view = new StatComparisonDocumentView();
                var vm = new StatComparisonDocumentVM(this, view.CommandBindings, persistentInfo);
                view.ViewModel = vm;

                var docInfo = new DocumentInfo(guid: guid,
                                               repositoryId: null,
                                               uri: uri,
                                               title: this.L("stat_comparer", "new_comparison_default_title"),
                                               content: view,
                                               features: new IFeature[] { vm },
                                               persistentInfoProvider: vm.PersistentInfo)
                {
                    IconSource = StatComparerModule.CompareIcon
                };
                vm.DocumentInfo = docInfo;

                return docInfo;
            }));
        }