void btn_Checked(object sender, RoutedEventArgs e)
        {
            var btn = sender as RadioButton;

            _testType = (TestType)(int)btn.GetValue(Grid.ColumnProperty);
            MyCellFactory.StoreValue(this, _testType);
        }
        public MainWindow()
        {
            InitializeComponent();

            // create grid
            _flex = new C1FlexGrid();
            _flex.RowBackground            = new SolidColorBrush(Colors.White);
            _flex.AlternatingRowBackground = _flex.RowBackground;
            _flex.GridLinesVisibility      = C1.WPF.FlexGrid.GridLinesVisibility.All;
            LayoutRoot.Children.Add(_flex);

            // add extra column header row
            _flex.ColumnHeaders.Rows.Add(new Row());

            // set up merging
            _flex.AllowMerging = AllowMerging.ColumnHeaders;
            _flex.ColumnHeaders.Rows[0].AllowMerging = true;

            // add columns
            AddColumn("TRANSDUCERS", "No", typeof(int), 30, HorizontalAlignment.Center);
            AddColumn("TRANSDUCERS", "Use", typeof(string), 60, HorizontalAlignment.Right);
            AddColumn("TRANSDUCERS", "Name", typeof(string), 80, HorizontalAlignment.Left);
            AddColumn("TRANSDUCERS", "Parameter", typeof(string), 80, HorizontalAlignment.Left);
            AddColumn("TRANSDUCERS", "Fullscale", typeof(int), 60, HorizontalAlignment.Center);
            AddColumn("TRANSDUCERS", "Units", typeof(string), 40, HorizontalAlignment.Center);
            AddColumn("TRANSDUCERS", "Test Type", typeof(TestType), 140, HorizontalAlignment.Center);
            AddColumn("Input", "Enable", typeof(bool), 60, HorizontalAlignment.Center);
            AddColumn("Input", "Fault", typeof(FaultType), 40, HorizontalAlignment.Center);
            AddColumn("Sense", "Enable", typeof(bool), 60, HorizontalAlignment.Center);
            AddColumn("Sense", "Fault", typeof(FaultType), 40, HorizontalAlignment.Center);
            AddColumn("Excitation", "Enable", typeof(bool), 60, HorizontalAlignment.Center);
            AddColumn("Excitation", "Fault", typeof(FaultType), 40, HorizontalAlignment.Center);

            // use combo to edit 'Use' column
            var options = "FB,CT,JK,CB,TZ,LZ".Split(',');

            _flex.Columns["TRANSDUCERS.Use"].ValueConverter = new ColumnValueConverter(options, true);

            // add some data
            for (int i = 0; i < 10; i++)
            {
                var row = new Row();
                _flex.Rows.Add(row);
                row["TRANSDUCERS.No"]        = i;
                row["TRANSDUCERS.Use"]       = "FB";
                row["TRANSDUCERS.Name"]      = "Hello";
                row["TRANSDUCERS.Parameter"] = "Disp - FB";
                row["TRANSDUCERS.Fullscale"] = 100;
                row["TRANSDUCERS.Units"]     = "mm";
                row["Input.Enable"]          = true;
                row["Input.Fault"]           = FaultType.None;
                row["Sense.Enable"]          = true;
                row["Sense.Fault"]           = FaultType.None;
                row["Excitation.Enable"]     = true;
                row["Excitation.Fault"]      = FaultType.None;
            }

            // apply custom cell factory
            var cf = new MyCellFactory();

            _flex.CellFactory    = cf;
            cf.CellValueChanged += cf_CellValueChanged;
        }
 void CheckCell_Checked(object sender, RoutedEventArgs e)
 {
     MyCellFactory.StoreValue(this, this.IsChecked);
 }
Ejemplo n.º 4
0
        public MainWindow()
        {
            InitializeComponent();

            // create grid
            _flex = new C1FlexGrid();
            _flex.RowBackground = new SolidColorBrush(Colors.White);
            _flex.AlternatingRowBackground = _flex.RowBackground;
            _flex.GridLinesVisibility = C1.WPF.FlexGrid.GridLinesVisibility.All;
            LayoutRoot.Children.Add(_flex);

            // add extra column header row
            _flex.ColumnHeaders.Rows.Add(new Row());

            // set up merging
            _flex.AllowMerging = AllowMerging.ColumnHeaders;
            _flex.ColumnHeaders.Rows[0].AllowMerging = true;

            // add columns
            AddColumn("TRANSDUCERS", "No", typeof(int), 30, HorizontalAlignment.Center);
            AddColumn("TRANSDUCERS", "Use", typeof(string), 60, HorizontalAlignment.Right);
            AddColumn("TRANSDUCERS", "Name", typeof(string), 80, HorizontalAlignment.Left);
            AddColumn("TRANSDUCERS", "Parameter", typeof(string), 80, HorizontalAlignment.Left);
            AddColumn("TRANSDUCERS", "Fullscale", typeof(int), 60, HorizontalAlignment.Center);
            AddColumn("TRANSDUCERS", "Units", typeof(string), 40, HorizontalAlignment.Center);
            AddColumn("TRANSDUCERS", "Test Type", typeof(TestType), 140, HorizontalAlignment.Center);
            AddColumn("Input", "Enable", typeof(bool), 60, HorizontalAlignment.Center);
            AddColumn("Input", "Fault", typeof(FaultType), 40, HorizontalAlignment.Center);
            AddColumn("Sense", "Enable", typeof(bool), 60, HorizontalAlignment.Center);
            AddColumn("Sense", "Fault", typeof(FaultType), 40, HorizontalAlignment.Center);
            AddColumn("Excitation", "Enable", typeof(bool), 60, HorizontalAlignment.Center);
            AddColumn("Excitation", "Fault", typeof(FaultType), 40, HorizontalAlignment.Center);

            // use combo to edit 'Use' column
            var options = "FB,CT,JK,CB,TZ,LZ".Split(',');
            _flex.Columns["TRANSDUCERS.Use"].ValueConverter = new ColumnValueConverter(options, true);

            // add some data
            for (int i = 0; i < 10; i++)
            {
                var row = new Row();
                _flex.Rows.Add(row);
                row["TRANSDUCERS.No"] = i;
                row["TRANSDUCERS.Use"] = "FB";
                row["TRANSDUCERS.Name"] = "Hello";
                row["TRANSDUCERS.Parameter"] = "Disp - FB";
                row["TRANSDUCERS.Fullscale"] = 100;
                row["TRANSDUCERS.Units"] = "mm";
                row["Input.Enable"] = true;
                row["Input.Fault"] = FaultType.None;
                row["Sense.Enable"] = true;
                row["Sense.Fault"] = FaultType.None;
                row["Excitation.Enable"] = true;
                row["Excitation.Fault"] = FaultType.None;
            }

            // apply custom cell factory
            var cf = new MyCellFactory();
            _flex.CellFactory = cf;
            cf.CellValueChanged += cf_CellValueChanged;
        }