Exemplo n.º 1
0
        public KNTableColumn(string anIdentifier, string aTitle, KNCell aDataCell, KNTableColumnDelegate aDelegate)
        {
            ClipToBounds = true;

            activeCells = new Dictionary<int, KNCell>();
            cellCache = new ArrayList();

            sortPriority = SortPriority.NotUsed;
            sortDirection = SortDirection.Ascending;

            if (aDataCell != null) {
                dataCell = aDataCell;
            } else {
                dataCell = new KNTextCell();
            }

            minSize = 100;
            maxSize = 2000;
            Width = 100;
            userResizable = true;
            HeaderCell = new KNHeaderCell();
            headerCell.Column = this;

            del = aDelegate;

            if (anIdentifier != null) {
                identifier = anIdentifier;
            } else {
                identifier = "";
            }

            KNActionCellDependencyProperty.SetDelegate((DependencyObject)headerCell, this);
            if (aTitle != null) {
                KNCellDependencyProperty.SetObjectValue((DependencyObject)headerCell, aTitle);
            } else {
                KNCellDependencyProperty.SetObjectValue((DependencyObject)headerCell, "Column Title");
            }

            this.AddObserverToKeyPathWithOptions(this, "VerticalOffset", 0, null);
            this.AddObserverToKeyPathWithOptions(this, "RowHeight", 0, null);
            this.AddObserverToKeyPathWithOptions(this, "DataCell", 0, null);

            LayoutCompletely();
        }
Exemplo n.º 2
0
 public int RowForCell(KNCell cell)
 {
     if (!activeCells.ContainsValue(cell)) {
         return -1;
     } else {
         foreach (int row in activeCells.Keys) {
             if (activeCells[row].Equals(cell)) {
                 return row;
             }
         }
     }
     return -1;
 }