Esempio n. 1
0
        public TabularDataViewer(IBioLinkReport report, DataMatrix data, IProgressObserver progress)
        {
            InitializeComponent();
            this.Data = data;
            _progress = progress;
            _report   = report;
            var view = new GridView();

            var columns = report.DisplayColumns;

            if (columns == null || columns.Count == 0)
            {
                columns = GenerateDefaultColumns(data);
            }

            var hcs = viewerGrid.Resources["hcs"] as Style;

            foreach (DisplayColumnDefinition c in columns)
            {
                DisplayColumnDefinition coldef = c;
                var column = new GridViewColumn {
                    Header = BuildColumnHeader(coldef), DisplayMemberBinding = new Binding(String.Format("[{0}]", data.IndexOf(coldef.ColumnName))), HeaderContainerStyle = hcs
                };
                view.Columns.Add(column);
            }

            lvw.AddHandler(ButtonBase.ClickEvent, new RoutedEventHandler(GridViewColumnHeaderClickedHandler));

            lvw.MouseRightButtonUp += new System.Windows.Input.MouseButtonEventHandler(lvw_MouseRightButtonUp);

            lvw.ItemsSource = Data.Rows;
            this.lvw.View   = view;
        }
Esempio n. 2
0
        private object BuildColumnHeader(DisplayColumnDefinition coldef)
        {
            var t = new TextBlock();

            t.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            t.TextAlignment       = TextAlignment.Left;
            t.Tag  = coldef;
            t.Text = coldef.DisplayName;
            return(t);
        }
Esempio n. 3
0
        protected DisplayColumnDefinition DefineColumn(string name, string display = null)
        {
            if (display == null)
            {
                display = name;
            }
            DisplayColumnDefinition coldef = new DisplayColumnDefinition {
                ColumnName = name, DisplayName = display
            };

            _columnDefinitions.Add(coldef);
            return(coldef);
        }
Esempio n. 4
0
        private void Sort(DisplayColumnDefinition coldef, ListSortDirection direction)
        {
            var dataView = CollectionViewSource.GetDefaultView(lvw.ItemsSource) as ListCollectionView;

            if (dataView != null)
            {
                dataView.SortDescriptions.Clear();
                int columnIndex = Data.IndexOf(coldef.ColumnName);
                var sd          = new SortDescription(String.Format("[{0}]", columnIndex), direction);
                dataView.SortDescriptions.Add(sd);
                dataView.Refresh();
            }
        }
Esempio n. 5
0
        private List <DisplayColumnDefinition> GenerateDefaultColumns(DataMatrix data)
        {
            var list = new List <DisplayColumnDefinition>();

            foreach (MatrixColumn col in data.Columns)
            {
                if (!col.IsHidden)
                {
                    var colDef = new DisplayColumnDefinition {
                        ColumnName = col.Name, DisplayName = col.Name
                    };
                    list.Add(colDef);
                }
            }
            return(list);
        }
Esempio n. 6
0
 protected void DefineColumn(DisplayColumnDefinition coldef)
 {
     _columnDefinitions.Add(coldef);
 }
Esempio n. 7
0
 private void Sort(DisplayColumnDefinition coldef, ListSortDirection direction)
 {
     var dataView = CollectionViewSource.GetDefaultView(lvw.ItemsSource) as ListCollectionView;
     if (dataView != null) {
         dataView.SortDescriptions.Clear();
         int columnIndex = Data.IndexOf(coldef.ColumnName);
         var sd = new SortDescription(String.Format("[{0}]", columnIndex), direction);
         dataView.SortDescriptions.Add(sd);
         dataView.Refresh();
     }
 }
Esempio n. 8
0
 private List<DisplayColumnDefinition> GenerateDefaultColumns(DataMatrix data)
 {
     var list = new List<DisplayColumnDefinition>();
     foreach (MatrixColumn col in data.Columns) {
         if (!col.IsHidden) {
             var colDef = new DisplayColumnDefinition { ColumnName = col.Name, DisplayName = col.Name };
             list.Add(colDef);
         }
     }
     return list;
 }
Esempio n. 9
0
 private object BuildColumnHeader(DisplayColumnDefinition coldef)
 {
     var t = new TextBlock();
     t.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
     t.TextAlignment = TextAlignment.Left;
     t.Tag = coldef;
     t.Text = coldef.DisplayName;
     return t;
 }
Esempio n. 10
0
 protected DisplayColumnDefinition DefineColumn(string name, string display = null)
 {
     if (display == null) {
         display = name;
     }
     DisplayColumnDefinition coldef = new DisplayColumnDefinition { ColumnName = name, DisplayName = display };
     _columnDefinitions.Add(coldef);
     return coldef;
 }
Esempio n. 11
0
 protected void DefineColumn(DisplayColumnDefinition coldef)
 {
     _columnDefinitions.Add(coldef);
 }