Beispiel #1
0
        //--------------------------------------------------------------------------
        #region ** ctor

        public Sheet(XLSheet xlSheet)
        {
            // customize style
            FontSize   = 14;
            FontFamily = new FontFamily("Arial");
            Padding    = new Thickness(0);

            // create grid to hold the sheet data
            Grid = new C1FlexGrid();
            Grid.MergeManager = new ExcelMergeManager();

            // create editable label used as a header
            var label = new EditableLabel();

            Header = label;

            // create context menu for this sheet
            var ctxMenu = new SheetContextMenu(this);

            // if we have a sheet, get its name and load it into the grid
            if (xlSheet != null)
            {
                SheetName = xlSheet.Name;
                ExcelFilter.Load(xlSheet, this.Grid);
                Visibility = xlSheet.Visible ? Visibility.Visible : Visibility.Collapsed;
            }

            // keep track of changes to the sheet name
            label.TextChanged += label_TextChanged;
        }
 // keep track of focused element
 void _txt_GotFocus(object sender, RoutedEventArgs e)
 {
     if (_focused != null && _focused != this)
     {
         _focused.SetEditable(false);
     }
     _focused = _txt.Parent as EditableLabel;
 }
        // handle clicks and double-clicks
        void _tb_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            // remove focus from any other editable labels
            if (_focused != null && _focused != this)
            {
                _focused.SetEditable(false);
                _focused = null;
            }

            // start editing on double-click
            var now = DateTime.Now;

            if (now.Subtract(_lastMouseDown).TotalMilliseconds < 250)
            {
                e.Handled = true;
                SetEditable(true);
            }
            _lastMouseDown = now;
        }
 // keep track of focused element
 void _txt_GotFocus(object sender, RoutedEventArgs e)
 {
     if (_focused != null && _focused != this)
     {
         _focused.SetEditable(false);
     }
     _focused = _txt.Parent as EditableLabel;
 }
        // handle clicks and double-clicks
        void _tb_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            // remove focus from any other editable labels
            if (_focused != null && _focused != this)
            {
                _focused.SetEditable(false);
                _focused = null;
            }

            // start editing on double-click
            var now = DateTime.Now;
            if (now.Subtract(_lastMouseDown).TotalMilliseconds < 250)
            {
                e.Handled = true;
                SetEditable(true);
            }
            _lastMouseDown = now;
        }