コード例 #1
0
        public void Contribute(View view)
        {
            var tables = view.Children().OfType <TableHost>();

            foreach (var holder in tables)
            {
                var table = holder.Table;
                table.CellSpacing = 1;
                table.RegisterBehavior(
                    new ToolTipBehavior(),
                    new SortInList(),
                    new RowSelectionBehavior());

                if (!String.IsNullOrEmpty(holder.Name))
                {
                    var name = view.GetType().Name + "." + holder.Name;

                    if (!WidthHolder.Widths.ContainsKey(name))
                    {
                        WidthHolder.Widths.Add(name, new List <int>());
                    }

                    var widths = WidthHolder.Widths[name];

                    var resizeBehavior = new ColumnResizeBehavior();
                    resizeBehavior.ColumnResized += column => WidthHolder.Update(table, column, widths);
                    table.RegisterBehavior(resizeBehavior);
                    table.TemplateManager.RegisterDecorator(new SetColumnSizeDecorator(widths));
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ExtendedListView"/> class.
        /// </summary>
        public ExtendedListView()
        {
            // Creating the rows collection.
            this.Rows = new RowsCollection(this);

            // Creating the models.
            this.SelectionModel = new SelectionModel(this);
            this.CheckModel     = new CheckModel();
            this.ExpandModel    = new ExpandModel(this);

            // Creating the behaviors.
            this.mSelectionBehavior    = new SelectionBehavior(this);
            this.mExpandBehavior       = new ExpandBehavior(this);
            this.mColumnResizeBehavior = new ColumnResizeBehavior(this);
        }