Example #1
0
        private static void OnClearSettingsCommandExecute(HeaderCommandParameter parameter)
        {
            Argument.IsNotNull(() => parameter);

            var grid = parameter.Grid;

            if (grid.FieldLayouts.FirstOrDefault() != null)
            {
                var fields = grid.FieldLayouts.First().Fields;

                foreach (var field in fields)
                {
                    field.Visibility = Visibility.Visible;
                    field.Width      = FieldLength.Auto;
                    field.CellValuePresenterStyle = null;
                }
            }

            grid.SetValue(Control.FontSizeProperty, Convert.ToDouble(GridViewFontSizeDefault));
            grid.SetValue(Control.FontFamilyProperty, new FontFamily(GridViewFontFamilyDefault));
            grid.SetValue(Control.FontStyleProperty, GridCustomizationHelpers.GetFontStyleFomString(GridViewFontStyleDefault));

            grid.FieldSettings.CellHeight = GridRowSizeHelper.GetRowHeightFromFontSize(grid.FontSize);

            foreach (var fieldlayout in parameter.Grid.FieldLayouts)
            {
                fieldlayout.RecordFilters.Clear();
            }

            RemoveColumnDescriptor(parameter);
        }
Example #2
0
        private static void OnManageFontCompleted(object sender, UICompletedEventArgs e)
        {
            if (!(e.DataContext is ManageFontViewModel dataContext) || !e.Result.HasValue || !e.Result.Value)
            {
                return;
            }
            try
            {
                var grid = dataContext.Grid;

                grid.SetValue(Control.FontSizeProperty, Convert.ToDouble(dataContext.SelectedFontSize));
                grid.SetValue(Control.FontFamilyProperty, new FontFamily(dataContext.SelectedFont));
                grid.SetValue(Control.FontStyleProperty, GridCustomizationHelpers.GetFontStyleFomString(dataContext.SelectedFontStyle));

                grid.FieldSettings.CellHeight = GridRowSizeHelper.GetRowHeightFromFontSize(grid.FontSize);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
                //ServiceLocator.Default.ResolveType<IExceptionService>().Process(() => throw new DefaultException(ex));
            }
        }