コード例 #1
0
        internal Size MeasureTextByFormattedText(Size rectangle, GridColumnBase column, object record, GridQueryBounds queryBound, FormattedText formattedtext)
        {
            formattedtext.Trimming = TextTrimming.None;
            if (queryBound == GridQueryBounds.Height)
            {
                formattedtext.MaxTextHeight = double.MaxValue;

                //if column is null, then stackedcolumn text is measured.
                if (column == null)
                {
                    formattedtext.MaxTextWidth = rectangle.Width;
                    //Here six is added to the formattedtext height,
                    //because while calculating auto-height for headers with textblock ( AllowMeasureTextByFormattedText as False), we have measured the textblock by top and bottom margin as 3.
                    return(new Size(formattedtext.Width, formattedtext.Height + 6));
                }
                else
                {
                    formattedtext.MaxTextWidth = column.IsHidden || column.Width == 0.0 ? GetDefaultLineSize() : rectangle.Width;
                }

                if (column.hasMargin)
                {
                    if (formattedtext.MaxTextWidth > (GetMargin(column).Left + GetMargin(column).Right))
                    {
                        formattedtext.MaxTextWidth -= (GetMargin(column).Left + GetMargin(column).Right);
                    }
                }

                else
                {
                    if (formattedtext.MaxTextWidth > (Margin.Left + Margin.Right))
                    {
                        formattedtext.MaxTextWidth -= (Margin.Left + Margin.Right);
                    }
                }

                //Here six is added to the formattedtext height,
                //because while calculating auto-height for headers with textblock ( AllowMeasureTextByFormattedText as False), we have measured the textblock by top and bottom margin as 3.
                if (record == null)
                {
                    return(new Size(formattedtext.Width, formattedtext.Height + 6));
                }

                return(new Size(formattedtext.Width, formattedtext.Height));
            }
            else
            {
                //The MaxTextWidth value must be between '0' and '3579139.40666667'
                formattedtext.MaxTextWidth  = 3579139;
                formattedtext.MaxTextHeight = double.MaxValue;
                if (column.hasMargin)
                {
                    return(new Size(formattedtext.Width + (GetMargin(column).Left + GetMargin(column).Right), formattedtext.Height));
                }
                else
                {
                    return(new Size(formattedtext.Width + (Margin.Left + Margin.Right), formattedtext.Height));
                }
            }
        }
コード例 #2
0
        internal Size MeasureTextByTextBlock(Size rectangle, string displayText, GridColumnBase column, object record, GridQueryBounds queryBound, TextBlock textBlock)
        {
            textBlock.Text = displayText;
            var parentBorder = new Border {
                Child = textBlock
            };

            if (queryBound == GridQueryBounds.Height)
            {
                if (column == null)
                {
                    textBlock.MaxWidth = rectangle.Width;
                }
                else
                {
                    textBlock.MaxWidth = column.IsHidden || column.Width == 0.0 ? GetDefaultLineSize() : rectangle.Width;
                }

                textBlock.MaxHeight = double.PositiveInfinity;
            }
            else
            {
                textBlock.MaxHeight = rectangle.Height;
                textBlock.MaxWidth  = double.PositiveInfinity;
                //Calculating MaxWidth for ParentBorder was created an issue when the Text size is Greater than VisualContainer.TotalExtent value. Hence we removing this code.
                //var totalWidth = this.dataGrid.VisualContainer.ColumnWidths.TotalExtent;
                //parentBorder.MaxWidth = totalWidth;
            }
            //WPF-19471 To get correct text area size , Must pass textblock maximum width and maximum height for measure text area
            parentBorder.Measure(new Size(textBlock.MaxWidth, textBlock.MaxHeight));
            parentBorder.Child = null;
            return(parentBorder.DesiredSize);
        }
コード例 #3
0
 /// <summary>
 /// Sorts Grid columns by position
 /// </summary>
 /// <param name="A"></param>
 /// <param name="B"></param>
 /// <returns></returns>
 public static int SortByPosition(GridColumnBase A, GridColumnBase B)
 {
     if ((A is PredefinedColumn))
     {
         if (B is PredefinedColumn)
         {
             return(0);
         }
         else
         {
             return(-1);
         }
     }
     else
     {
         if (B is PredefinedColumn)
         {
             return(1);
         }
         else
         {
             return(A.Position.CompareTo(B.Position));
         }
     }
 }
コード例 #4
0
 /// <summary>
 /// Resets the auto width for the specified column.
 /// </summary>
 /// <param name="column">
 /// The corresponding column to reset the auto width.
 /// </param>
 /// <remarks>
 /// The column width is reset to <b>double.Nan</b> ,if the column sizing is need to recalculate based on the data.
 /// </remarks>
 /// <exception cref="System.InvalidOperationException">Thrown when the column is null.</exception>
 public void ResetAutoCalculation(GridColumnBase column)
 {
     if (column == null)
     {
         throw new InvalidOperationException("Column Should not be null to perform this operation");
     }
     column.AutoWidth = double.NaN;
 }
コード例 #5
0
 /// <summary>
 /// Sets the width for the specified column based on <see cref="Syncfusion.UI.Xaml.Grid.GridLengthUnitType.Auto"/> column sizer.
 /// </summary>
 /// <param name="column">
 /// The corresponding column to set Auto width.
 /// </param>
 /// <param name="width">
 /// The corresponding width set as Auto width.
 /// </param>
 /// <exception cref="System.InvalidOperationException">Thrown when the column is null.</exception>
 internal void SetAutoWidth(GridColumnBase column, double width)
 {
     if (column == null)
     {
         throw new InvalidOperationException("Column Should not be null to perform this operation");
     }
     column.AutoWidth = width;
 }
コード例 #6
0
ファイル: GridBase.cs プロジェクト: alexarriete/BlazorGrid
        protected async Task HandleMouseUp(GridColumnBase gridColumn)
        {
            List <string> options = (await GridConfig.GetSourceListAsync())
                                    .Select(n => gridColumn.PropertyInfo.GetValue(n, null).ToString())
                                    .Distinct().Take(11).ToList();

            await GridSearch.CreateGridSearch(gridColumn, options.Count() <= 10?options : null);
        }
コード例 #7
0
 /// <summary>
 /// Gets the content presenter to measure the template when column sizer is SizeToCells.
 /// </summary>
 /// <param name="column">
 /// The corresponding column to get the content presenter.
 /// </param>
 /// <param name="record">
 /// The corresponding record to get the content presenter.
 /// </param>
 /// <returns>
 /// Returns the <see cref="System.Windows.Controls.ContentPresenter"/> for the specified column and record.
 /// </returns>
 internal ContentPresenter GetControl(GridColumnBase column, object record)
 {
     if (Control == null)
     {
         Control = new ContentPresenter();
     }
     return(Control);
 }
コード例 #8
0
        private static BindingMode SetBindingMode(GridColumnBase column, PropertyPath path)
        {
            var isModeSet   = false;
            var bindingMode = BindingMode.TwoWay;
            PropertyDescriptorCollection itemproperties = null;

            if (column.GridBase != null)
            {
                if (column.GridBase is SfTreeGrid)
                {
                    var SfTreeGrid = (column.GridBase as SfTreeGrid);
                    if (SfTreeGrid.View != null)
                    {
                        itemproperties = SfTreeGrid.View.GetItemProperties();
                    }
                }
                else
                {
                    var sfDataGrid = (column.GridBase as SfDataGrid);
                    if (sfDataGrid.View != null)
                    {
                        itemproperties = sfDataGrid.View.GetItemProperties();
                    }
                }
            }

            if (itemproperties != null)
            {
                var propDesc = itemproperties.GetPropertyDescriptor(column.MappingName);
                if (propDesc != null)
                {
#if WPF
                    bindingMode = propDesc.IsReadOnly ? BindingMode.OneWay : BindingMode.TwoWay;
#else
                    bindingMode = (propDesc.SetMethod == null || !propDesc.SetMethod.IsPublic) ? BindingMode.OneWay : BindingMode.TwoWay;
#endif
                    isModeSet = true;
                }
            }

            //While implementing the IDataErroInfo, will generate Error read only property. Based on this property created a column when AutoGenerateColumn is True.
            //so that mode will be reset based on AllowEditing property of that Error column.

            if (!isModeSet)
            {
                if (column.AllowEditing && column.CanEditCell())
                {
                    bindingMode = BindingMode.TwoWay;
                }
                else
                {
                    bindingMode = BindingMode.OneWay;
                }
                isModeSet = true;
            }
            return(bindingMode);
        }
コード例 #9
0
        /// <summary>
        /// Gets the TextBlock to measure the text when the column sizer is <see cref="Syncfusion.UI.Xaml.Grid.GridLengthUnitType.SizeToCells"/> or <see cref="Syncfusion.UI.Xaml.Grid.GridLengthUnitType.Auto"/>.
        /// </summary>
        /// <param name="column">
        /// The corresponding column to get the TextBlock.
        /// </param>
        /// <param name="record">
        /// The corresponding record to get the TextBlock.
        /// </param>
        /// <param name="queryBounds">
        /// Indicates whether the text is measured based on the height or width of the cell.
        /// </param>
        /// <returns>
        /// Returns the TextBlock for the specified column and record.
        /// </returns>
        internal TextBlock GetTextBlock(GridColumnBase column, object record, GridQueryBounds queryBounds)
        {
            if (TextBlock == null)
            {
                TextBlock = new TextBlock();
            }

            if (record == null)
            {
                TextBlock.FontFamily  = FontFamily;
                TextBlock.FontStretch = FontStretch;

                //auto-row height calculation for headers and stacked header.
                if (queryBounds == GridQueryBounds.Height)
                {
                    TextBlock.Margin = new Thickness(5, 3, 5, 3);
                }
                else
                {
#if WPF
                    TextBlock.Margin = new Thickness(10, 3, 2, 3);
#else
                    TextBlock.Margin = new Thickness(10, 3, 10, 3);
#endif
                }

#if WPF
                //WPF-23198 While calculating the TextBlock size, we have to set the FontSize of TextBlock as same as in view.
                //For Header we have FontSize as 14 so we need to calculate the TextBlock size for header by using 14.
                TextBlock.FontSize   = 14;
                TextBlock.FontWeight = FontWeights.Normal;
#else
                TextBlock.FontSize   = 16;
                TextBlock.FontWeight = FontWeights.SemiBold;
#endif

                if (column != null)
                {
                    TextBlock.HorizontalAlignment = column.HorizontalHeaderContentAlignment;
                }
                cachedColumn = null;
            }
            else
            {
                if (cachedColumn != column)
                {
                    cachedColumn          = column;
                    TextBlock.FontFamily  = column != null && column.hasFontFamily ? GetFontFamily(column) : FontFamily;
                    TextBlock.Margin      = GetMargin(column, queryBounds);
                    TextBlock.FontSize    = column != null && column.hasFontSize ? GetFontSize(column) : FontSize;
                    TextBlock.FontWeight  = column != null && column.hasFontWeight ? GetFontWeight(column) : FontWeight;
                    TextBlock.FontStretch = column != null && column.hasFontStretch ? GetFontStretch(column) : FontStretch;
                }
            }
            TextBlock.TextWrapping = queryBounds == GridQueryBounds.Height ? TextWrapping.Wrap : TextWrapping.NoWrap;
            return(TextBlock);
        }
コード例 #10
0
        internal Size MeasureHeaderTemplate(GridColumnBase column, Size rect, GridQueryBounds bounds, ContentPresenter ctrl)
#endif
        {
#if UWP
            var _popUp = GetPopUp();
            _popUp.Child = ctrl;
            if (bounds == GridQueryBounds.Height)
            {
                ctrl.Margin = new Thickness(5, 3, 5, 3);
            }
            else
            {
                ctrl.Margin = new Thickness(10, 3, 10, 3);
            }
#endif
            ctrl.Measure(new Size());
            ctrl.Content         = column.HeaderText;
            ctrl.ContentTemplate = column.HeaderTemplate;
            var controlSize = Size.Empty;
            if (bounds == GridQueryBounds.Height)
            {
                double iconsWidth = 0;
                if (this.GridBase.SortColumnDescriptions.Any(item => item.ColumnName == column.MappingName))
                {
                    iconsWidth += SortIconWidth;
                }
                iconsWidth += column.GetFilterIconWidth();
                ctrl.Measure(new Size(rect.Width - iconsWidth, Double.PositiveInfinity));
                controlSize          = ctrl.DesiredSize;
                ctrl.ContentTemplate = null;
#if UWP
                _popUp.Child = null;
#endif
                if (controlSize.Height == 0)
                {
                    return(new Size(controlSize.Width, this.GridBase.HeaderRowHeight));
                }

                //When we calculate the height of the HeaderTemplate we need to add the  margin and padding
                return(new Size(controlSize.Width, controlSize.Height + margin.Top + margin.Bottom));
            }
            else
            {
                ctrl.Measure(new Size(Double.PositiveInfinity, rect.Height));
                controlSize          = ctrl.DesiredSize;
                ctrl.ContentTemplate = null;
#if UWP
                _popUp.Child = null;
#endif
                if (controlSize.Width == 0)
                {
                    return(new Size(150, controlSize.Height));
                }
            }

            return(controlSize);
        }
コード例 #11
0
        private Thickness ProcessUIElementPadding(GridColumnBase column)
        {
            var padLeft   = column.Padding.Left;
            var padRight  = column.Padding.Right;
            var padTop    = column.Padding.Top;
            var padBotton = column.Padding.Bottom;
            var padding   = column.ReadLocalValue(GridColumnBase.PaddingProperty);

            return(padding != DependencyProperty.UnsetValue
                           ? new Thickness(-1 + padLeft, padTop, 3 + padRight, padBotton)
                           : new Thickness(-1, 0, 3, 0));
        }
コード例 #12
0
 protected virtual void Dispose(bool disposing)
 {
     if (isdisposed)
     {
         return;
     }
     GridBase     = null;
     cachedColumn = null;
     Control      = null;
     TextBlock    = null;
     isdisposed   = true;
 }
        public object Format(string format, GridColumnBase gridColumn, object record, object value)
        {
            if (value == null)
            {
                throw new ArgumentNullException((value == null) ? "format" : "args");
            }

            if (gridColumn is GridColumn && (gridColumn as GridColumn).MappingName == "Value")
            {
                var orderInfo = record as OrderInfo;
                return((Convert.ToDecimal((orderInfo.Value.ToString()))).ToString("0.00%"));
            }
            return(value.ToString());
        }
コード例 #14
0
        /// <summary>
        /// Gets the formatted text for the specified column.
        /// </summary>
        /// <param name="column">
        /// The corresponding column to get the formatted text.
        /// </param>
        /// <param name="record">
        /// The corresponding record to get the formatted text.
        /// </param>
        /// <param name="displaytext">
        /// The corresponding display text to get formatted text.
        /// </param>
        /// <returns>
        /// Returns the formatted text for the specified column.
        /// </returns>
        internal FormattedText GetFormattedText(GridColumnBase column, object record, string displaytext)
        {
            //WPF-23198 While calculating the FormattedText, we have set the FontSize of GridColumnSizer as same as in view.
            //For Header we have FontSize as 14 so we need to calculate the formatted text by using 14.
            FormattedText formattedtext;

            if (record == null)
            {
                formattedtext = new FormattedText(displaytext, System.Globalization.CultureInfo.CurrentCulture, GridBase.FlowDirection, new Typeface(FontFamily, new FontStyle(), FontWeights.Normal, FontStretch), 14, Brushes.Black);
            }
            else
            {
                formattedtext = new FormattedText(displaytext, System.Globalization.CultureInfo.CurrentCulture, GridBase.FlowDirection, new Typeface(column.hasFontFamily ? GetFontFamily(column) : FontFamily, new FontStyle(), column.hasFontWeight ? GetFontWeight(column) : FontWeight, column.hasFontStretch ? GetFontStretch(column) : FontStretch), column.hasFontSize ? GetFontSize(column) : FontSize, Brushes.Black);
            }
            return(formattedtext);
        }
コード例 #15
0
        /// <summary>
        /// Returns the padding value for corresponding grid column.
        /// </summary>
        /// <param name="column">GridColumn</param>
        /// <returns>Thickness</returns>
        internal Thickness GetMargin(GridColumnBase column, GridQueryBounds queryBounds)
        {
            Thickness _margin = Margin;

            if (column != null && column.hasMargin)
            {
                _margin = GetMargin(column);
            }
            if (queryBounds == GridQueryBounds.Height)
#if WPF
            { _margin.Left -= 0.5; }
#else
            { _margin.Left -= 6; }
#endif
            return(_margin);
        }
コード例 #16
0
        internal override void ProcessUIElementPadding(GridColumnBase column)
        {
            var padLeft   = column.Padding.Left;
            var padRight  = column.Padding.Right;
            var padTop    = column.Padding.Top;
            var padBotton = column.Padding.Bottom;
            var padding   = column.ReadLocalValue(GridColumnBase.PaddingProperty);

#if UWP
            this.padding = padding != DependencyProperty.UnsetValue
                           ? new Thickness(3 + padLeft, 3 + padTop, 5 + padRight, 5 + padBotton)
                           : new Thickness(3, 1, 6, 6);
#else
            this.padding = padding != DependencyProperty.UnsetValue
                           ? new Thickness(3 + padLeft, 1 + padTop, 3 + padRight, 1 + padBotton)
                           : new Thickness(3, 1, 3, 1);
#endif
        }
コード例 #17
0
        internal double CheckWidthConstraints(GridColumnBase column, double Width, double columnWidth)
        {
            if (!double.IsNaN(column.MinimumWidth) || !double.IsNaN(column.MaximumWidth))
            {
                if (!double.IsNaN(column.MaximumWidth))
                {
                    if (!double.IsNaN(Width) && column.MaximumWidth > Width)
                    {
                        columnWidth = Width;
                    }
                    else
                    {
                        columnWidth = column.MaximumWidth;
                    }
                }

                if (!double.IsNaN(column.MinimumWidth))
                {
                    if (!double.IsNaN(Width) && column.MinimumWidth < Width)
                    {
                        if (Width > column.MaximumWidth)
                        {
                            columnWidth = column.MaximumWidth;
                        }
                        else
                        {
                            columnWidth = Width;
                        }
                    }
                    else
                    {
                        columnWidth = column.MinimumWidth;
                    }
                }
            }
            else
            {
                if (!double.IsNaN(Width))
                {
                    columnWidth = Width;
                }
            }
            return(columnWidth);
        }
コード例 #18
0
        internal static Binding CreateEditableBinding(this string mappingName, GridColumnBase column, bool enableErrorNotification)
        {
            bool canBindTwoWay = column != null?column.CanEditCell() : true;

            var binding = new Binding
            {
                Path = new PropertyPath(mappingName),
                Mode = canBindTwoWay ? BindingMode.TwoWay : BindingMode.OneWay,
#if WPF
                NotifyOnValidationError = enableErrorNotification,
                ValidatesOnDataErrors   = enableErrorNotification,
#if !SyncfusionFramework4_0
                ValidatesOnNotifyDataErrors = enableErrorNotification
#endif
#endif
            };

            return(binding);
        }
コード例 #19
0
ファイル: GridBase.cs プロジェクト: alexarriete/BlazorGrid
 protected async Task SortColumn(GridColumnBase thisColumn)
 {
     foreach (GridColumnBase gridColumn in GridConfig.GridColumnBases)
     {
         if (gridColumn == thisColumn)
         {
             if (gridColumn.SortSymbol == "&#8593;")
             {
                 gridColumn.SortSymbol = "";
                 Sort = null;
             }
             else if (gridColumn.SortSymbol == "&#8595;")
             {
                 gridColumn.SortSymbol = "&#8593;";
                 Sort = new SortChangeEvent()
                 {
                     SortId = gridColumn.PropertyInfo.Name, Direction = SortDirection.Desc
                 };
             }
             else
             {
                 gridColumn.SortSymbol = "&#8595;";
                 //Sort = new SortChangedEvent();
                 Sort = new SortChangeEvent()
                 {
                     SortId = gridColumn.PropertyInfo.Name, Direction = SortDirection.Asc
                 };
             }
         }
         else
         {
             gridColumn.SortSymbol = "";
         }
     }
     GridConfig.ItemList = await GridConfig.GetPageAsync(Sort, GridSearch);
 }
コード例 #20
0
ファイル: GridBase.cs プロジェクト: alexarriete/BlazorGrid
 protected void HandleCellContextMenu(GridColumnBase gridColumn, object context)
 {
     CellContexMenu  = new CellContexMenuOption(gridColumn, context, GridConfig.UrlFolder);
     ShowContextMenu = true;
 }
コード例 #21
0
        /// <summary>
        /// Adds the GridColumnStyle for a column to the collection
        /// </summary>
        /// <param name="column">Column to add</param>
        private void SetColumnStyle(GridColumnBase column)
        {
            bool columnExists = false;
            DataGridTextBoxColumn textColumn = new DataGridTextBoxColumn();
            textColumn.MappingName = column.Name;
            textColumn.HeaderText = column.Text;
            textColumn.Width = (column.Width > 0 ? column.Width:75);
            textColumn.NullText = string.Empty;
            textColumn.WidthChanged += new EventHandler(textColumn_WidthChanged);

            foreach (DataGridColumnStyle col in dgColumns.TableStyles["GridColumns"].GridColumnStyles)
            {
                if (col.MappingName.Equals(textColumn.MappingName))
                {
                    columnExists = true;
                }
            }

            if (!columnExists)
            {
                this.dgColumns.TableStyles["GridColumns"].GridColumnStyles.Add(textColumn);
            }
        }
コード例 #22
0
        /// <summary>
        /// Deletes a grid column from the database.
        /// </summary>
        /// <param name="column">A grid column.</param>
        public void DeleteGridColumn(GridColumnBase column)
        {
            try
            {
                Query query = db.CreateQuery("delete from metaGridColumns where [GridColumnId] = @fieldId and [Name] = @Name");
                query.Parameters.Add(new QueryParameter("@fieldId", DbType.Int32, column.Id));
                query.Parameters.Add(new QueryParameter("@Name", DbType.String, column.Name));

                db.ExecuteNonQuery(query);
            }
            catch (Exception ex)
            {
                throw new GeneralException("Could not delete grid column in the database.", ex);
            }
        }
コード例 #23
0
 /// <summary>
 /// Gets the value of <see cref="Syncfusion.UI.Xaml.Grid.GridColumnSizer.Margin"/> property for the specified column.
 /// </summary>
 /// <param name="column">
 /// The corresponding column to get the margin.
 /// </param>
 /// <remarks>
 /// The specified margin is considered for column sizing calculation only.
 /// </remarks>
 public static Thickness GetMargin(GridColumnBase column)
 {
     return((Thickness)column.GetValue(MarginProperty));
 }
コード例 #24
0
 /// <summary>
 /// Sets the value of <see cref="Syncfusion.UI.Xaml.Grid.GridColumnSizer.Margin"/> property for the specified column.
 /// </summary>
 /// <param name="column">
 /// The corresponding column to set the margin.
 /// </param>
 /// <param name="value">
 /// The desired margin to set.
 /// </param>
 /// <remarks>
 /// The specified margin is considered for column sizing calculation only.
 /// </remarks>
 public static void SetMargin(GridColumnBase column, Thickness value)
 {
     column.SetValue(MarginProperty, value);
     column.hasMargin = true;
 }
コード例 #25
0
 /// <summary>
 /// Gets the value of <see cref="Syncfusion.UI.Xaml.Grid.GridColumnSizer.FontFamily"/> property for the specified column.
 /// </summary>
 /// <param name="column">
 /// The corresponding column to get the font family.
 /// </param>
 /// <remarks>
 /// The specified font family is considered for column sizing calculation only.
 /// </remarks>
 public static FontFamily GetFontFamily(GridColumnBase column)
 {
     return((FontFamily)column.GetValue(FontFamilyProperty));
 }
コード例 #26
0
 /// <summary>
 /// Sets the value of <see cref="Syncfusion.UI.Xaml.Grid.GridColumnSizer.FontFamily"/> property for the specified column.
 /// </summary>
 /// <param name="column">
 /// The corresponding column to set the font family.
 /// </param>
 /// <param name="value">
 /// The desired font family to set.
 /// </param>
 /// <remarks>
 /// The specified font family is considered for column sizing calculation only.
 /// </remarks>
 public static void SetFontFamily(GridColumnBase column, FontFamily value)
 {
     column.SetValue(FontFamilyProperty, value);
     column.hasFontFamily = true;
 }
コード例 #27
0
 /// <summary>
 /// Gets the value of <see cref="Syncfusion.UI.Xaml.Grid.GridColumnSizer.FontStretch"/> property for the specified column.
 /// </summary>
 /// <param name="column">
 /// The corresponding column to get the font stretch.
 /// </param>
 /// <remarks>
 /// The specified font stretch is considered for column sizing calculation only.
 /// </remarks>
 public static FontStretch GetFontStretch(GridColumnBase column)
 {
     return((FontStretch)column.GetValue(FontStretchProperty));
 }
コード例 #28
0
        /// <summary>
        /// Creates a Gridfield column in a GridField table.
        /// </summary>
        /// <param name="column">Grid Column to use as a table field.</param>
        /// <param name="tableName">Name of the GridField table.</param>
        private void CreateTableColumn(GridColumnBase column, string tableName)
        {
            string length = string.Empty;

            if (column.GetDbSpecificColumnType().Equals("nvarchar"))
            {
                length = "(4000)";
            }
            if (column.GetDbSpecificColumnType().Equals("nchar"))
            {
                length = "(4000)";
            }
            if (column.GetDbSpecificColumnType().Equals("text"))
            {
                length = "(255)";
            }

            string columnType = column.GetDbSpecificColumnType();

            string queryText = "alter table [" + tableName + "] add [" + column.Name + "] " + columnType + length;
            if (column.IsRequired)
            {
                queryText += " not null";
            }
            Query query = dbDriver.CreateQuery(queryText);
            dbDriver.ExecuteNonQuery(query);
        }
コード例 #29
0
 /// <summary>
 /// Sets the value of <see cref="Syncfusion.UI.Xaml.Grid.GridColumnSizer.FontWeight"/> property for the specified column.
 /// </summary>
 /// <param name="column">
 /// The corresponding column to set the font weight.
 /// </param>
 /// <param name="value">
 /// The desired font weight.
 /// </param>
 /// <remarks>
 /// The specified font weight is considered for column sizing calculation only.
 /// </remarks>
 public static void SetFontWeight(GridColumnBase column, FontWeight value)
 {
     column.SetValue(FontWeightProperty, value);
     column.hasFontWeight = true;
 }
コード例 #30
0
 /// <summary>
 /// Gets the value of <see cref="Syncfusion.UI.Xaml.Grid.GridColumnSizer.FontSize"/> property for the specified column.
 /// </summary>
 /// <param name="column">
 /// The corresponding column to get the font size.
 /// </param>
 /// <remarks>
 /// The specified font size is considered for column sizing calculation only.
 /// </remarks>
 public static double GetFontSize(GridColumnBase column)
 {
     return((double)column.GetValue(FontSizeProperty));
 }
コード例 #31
0
 /// <summary>
 /// Sets the value of <see cref="Syncfusion.UI.Xaml.Grid.GridColumnSizer.FontSize"/> property for the specified column.
 /// </summary>
 /// <param name="column">
 /// The corresponding column to set the font size to its text content.
 /// </param>
 /// <param name="value">
 /// The desired font size.
 /// </param>
 /// <remarks>
 /// The specified font size is considered for column sizing calculation only.
 /// </remarks>
 public static void SetFontSize(GridColumnBase column, double value)
 {
     column.SetValue(FontSizeProperty, value);
     column.hasFontSize = true;
 }
コード例 #32
0
        /// <summary>
        /// Updates the style of an existing column
        /// </summary>
        /// <param name="position">Position of the original column</param>
        /// <param name="column">Updated column</param>
        private void UpdateColumnStyle(int position, GridColumnBase column)
        {
            position = position - iColumnOffset;
            DataGridColumnStyle[] temp = new DataGridColumnStyle[dgColumns.TableStyles["GridColumns"].GridColumnStyles.Count];
            dgColumns.TableStyles["GridColumns"].GridColumnStyles.CopyTo(temp, 0);
            List<DataGridColumnStyle> styles = new List<DataGridColumnStyle>(temp);

            DataGridTextBoxColumn textColumn = new DataGridTextBoxColumn();
            textColumn.MappingName = column.Name;
            textColumn.HeaderText = column.Text;
            textColumn.Width = (column.Width > 0 ? column.Width : 75);
            textColumn.NullText = string.Empty;
            textColumn.WidthChanged += new EventHandler(textColumn_WidthChanged);

            styles.RemoveAt(position);
            styles.Insert(position, textColumn);

            dgColumns.TableStyles["GridColumns"].GridColumnStyles.Clear();
            dgColumns.TableStyles["GridColumns"].GridColumnStyles.AddRange(styles.ToArray());
        }
コード例 #33
0
ファイル: Util.cs プロジェクト: NALSS/epiinfo-82474
 /// <summary>
 /// Sorts Grid columns by position
 /// </summary>
 /// <param name="A"></param>
 /// <param name="B"></param>
 /// <returns></returns>
 public static int SortByPosition(GridColumnBase A, GridColumnBase B)
 {
     if ((A is PredefinedColumn))
     {
         if (B is PredefinedColumn)
         {
             return 0;
         }
         else
         {
             return -1;
         }
     }
     else
     {
         if (B is PredefinedColumn)
         {
             return 1;
         }
         else
         {
             return A.Position.CompareTo(B.Position);
         }
     }
 }
コード例 #34
0
 /// <summary>
 /// Gets the value of <see cref="Syncfusion.UI.Xaml.Grid.GridColumnSizer.FontWeight"/> property for the specified column.
 /// </summary>
 /// <param name="column">
 /// The corresponding column to get the font weight.
 /// </param>
 /// <remarks>
 /// The specified font weight is considered for column sizing calculation only.
 /// </remarks>
 public static FontWeight GetFontWeight(GridColumnBase column)
 {
     return((FontWeight)column.GetValue(FontWeightProperty));
 }
コード例 #35
0
 /// <summary>
 /// Sets the value of <see cref="Syncfusion.UI.Xaml.Grid.GridColumnSizer.FontStretch"/> property for the specified column.
 /// </summary>
 /// <param name="column">
 /// The corresponding column to set the font stretch.
 /// </param>
 /// <param name="value">
 /// The desired font stretch value.
 /// </param>
 /// <remarks>
 /// The specified font stretch is considered for column sizing calculation only.
 /// </remarks>
 public static void SetFontStretch(GridColumnBase column, FontStretch value)
 {
     column.SetValue(FontStretchProperty, value);
     column.hasFontStretch = true;
 }