public ColumnCalculation() { this.InitializeComponent(); List <Product> items = Product.GetData(); flexGrid.ItemsSource = items; C1ExpressionEditor c1ExpressionEditor1 = new C1ExpressionEditor(); C1ExpressionEditor c1ExpressionEditor2 = new C1ExpressionEditor(); c1ExpressionEditor1.Expression = "[Price]*0.95"; c1ExpressionEditor2.Expression = "[Price]*0.8"; flexGrid.ExpressionEditors.Add("CustomField1", c1ExpressionEditor1); flexGrid.ExpressionEditors.Add("CustomField2", c1ExpressionEditor2); if (!Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")) { InitalizeDesktop(); comboBox.SelectedIndex = 0; } else { comboBox.SelectedIndex = -1; } flexGrid.Loaded += FlexGrid_Loaded; }
// Change ExpressionEditor settings to allow edit expression for selected C1FlexGrid column. private void combobox_SelectionChanged(object sender, SelectionChangedEventArgs e) { var field = (e.AddedItems[0] as ComboBoxItem).Tag as string; if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")) { if (flexGrid != null && flexGrid.ExpressionEditors.Contains(field)) { if (_editor == null) { _editor = new C1ExpressionEditor(); } _editor.DataSource = flexGrid.ExpressionEditors[field].DataSource; _editor.Expression = flexGrid.ExpressionEditors[field].Expression; PageCache.SetCacheField(field); NavigateToExpressionEditor(); } } else { if (flexGrid != null && flexGrid.ExpressionEditors.Contains(field)) { editor.DataSource = flexGrid.ExpressionEditors[field].DataSource; editor.Expression = flexGrid.ExpressionEditors[field].Expression; } } }
private void ExpressionEditor_ExpressionChanged(object sender, EventArgs e) { C1ExpressionEditor editer = sender as C1ExpressionEditor; if (!editer.IsValid) { Result.Text = ""; Errors.Text = ""; editer.GetErrors().ForEach(x => { Errors.Text += x.Message + "\n"; }); } else { Result.Text = editer.Evaluate().ToString(); Errors.Text = ""; } }
public DropDownPanel(Control owner, C1ExpressionEditor editor) : base() { _owner = owner; InitializeComponent(); UpdateLocation(); MaximizeBox = false; MinimizeBox = false; KeyPreview = true; StartPosition = FormStartPosition.Manual; FormBorderStyle = FormBorderStyle.FixedDialog; ShowInTaskbar = false; // set ExpresionEditor property for panel c1ExpressionEditorPanel1.ExpressionEditor = editor; }
public C1FlexGridIntegration() { InitializeComponent(); List <Product> items = Product.GetData(200); flexGrid.ItemsSource = items; C1ExpressionEditor c1ExpressionEditor1 = new C1ExpressionEditor(); C1ExpressionEditor c1ExpressionEditor2 = new C1ExpressionEditor(); c1ExpressionEditor1.Expression = "[Price]*0.95"; c1ExpressionEditor2.Expression = "[Price]*0.8"; flexGrid.ExpressionEditors.Add("CustomField1", c1ExpressionEditor1); flexGrid.ExpressionEditors.Add("CustomField2", c1ExpressionEditor2); comboBox.SelectedIndex = 0; editor.OkClick += Editor_OkClick; editor.CancelClick += Editor_CancelClick; flexGrid.Loaded += FlexGrid_Loaded; }
public C1DataGridIntegration() { InitializeComponent(); List <Product> items = Product.GetData(200); CollectionViewSource view = new CollectionViewSource() { Source = items }; dataGrid.ItemsSource = view.View; C1ExpressionEditor c1ExpressionEditor1 = new C1ExpressionEditor(); C1ExpressionEditor c1ExpressionEditor2 = new C1ExpressionEditor(); c1ExpressionEditor1.Expression = "[Price]*0.95"; c1ExpressionEditor2.Expression = "[Price]*0.8"; dataGrid.ExpressionEditors.Add("CustomField1", c1ExpressionEditor1); dataGrid.ExpressionEditors.Add("CustomField2", c1ExpressionEditor2); comboBox.SelectedIndex = 0; editor.OkClick += Editor_OkClick; editor.CancelClick += Editor_CancelClick; }