// 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 FlexGrid_Loaded(object sender, RoutedEventArgs e)
        {
            flexGrid.AutoSizeColumns(0, 1, 2); // adjust column sizes to reflect long headers

            var field = PageCache.GetCacheField();

            if (flexGrid != null && flexGrid.ExpressionEditors.Contains(field))
            {
                flexGrid.ExpressionEditors[field].Expression = PageCache.GetCacheExpression();
                PageCache.SetCacheField("");
                PageCache.SetCacheExpression("");
            }
        }