GrapeCity MultiRow Windows Forms Documentation
ValueFormat Property
Example 


Gets or sets a System.String that is used to generate the header cell's caption.
Syntax
<SRCategoryAttribute("Behavior")>
<SRDescriptionAttribute("Indicates a string that is used to format the value.")>
<EditorAttribute(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="GrapeCity.Win.MultiRow.Design.ValueFormatEditor, GrapeCity.Win.MultiRow, Version=7.20.20141.0, Culture=neutral, PublicKeyToken=0f7a722ee3c2bdd9")>
<DefaultValueAttribute()>
Public Property ValueFormat As String
Dim instance As RowHeaderCell
Dim value As String
 
instance.ValueFormat = value
 
value = instance.ValueFormat
[SRCategory("Behavior")]
[SRDescription("Indicates a string that is used to format the value.")]
[Editor(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="GrapeCity.Win.MultiRow.Design.ValueFormatEditor, GrapeCity.Win.MultiRow, Version=7.20.20141.0, Culture=neutral, PublicKeyToken=0f7a722ee3c2bdd9")]
[DefaultValue()]
public string ValueFormat {get; set;}

Property Value

A System.String value that represents the RowHeaderCell's caption. The default is a null reference (Nothing in Visual Basic).
Exceptions
ExceptionDescription
System.InvalidOperationException Set this property in runtime.
Remarks

This property is used to generate the header cell's caption based on a specific format. For example, if you want to show the one-based index of the row in RowHeaderCell, you can set this property to "1".

The following table lists the valid format strings and their display result.

Format Displayed Result
"A" or "a" Displays sequential uppercase or lowercase letters (for b, displays b, c, d, and so on) .
"n" Displays sequential numbers (for 1, displays 1, 2, 3, and so on).
"" No caption.
"A" Displays the specified static string in the caption (displays "A", "A", "A", and so on).
"A and B" Displays the specified static and dynamic strings in the caption. The "A", "B" changes dynamically, and the string "and" remains static (displays "A and B", "B and C", and so on).
"Zz" Specfies to display uppercase and lowercase. The case in this example is determined for a string that is two characters. Any string added beyond that is treated as the first character of the format. (displays "aa" as "Aa", "aaa" as "AAa", "aaaa" as "AAAa")
"zZ" Specfies to display uppercase and lowercase. The case in this example is determined for a string that is two characters. Any string added beyond that is treated as the first character of the format. (displays "aa" as "aA", "aaa" as "aaA", "aaaa" as "aaaA")
"%A{n}%" Displays sequential letters that start with the specified character and are incremented by the count specified in {n}. {n} indicates the number of steps (for "A{2}", displays "A", "C", "E", and so on).
"%A{-n}%" Similar to the above, except that it starts with the specified character and is decremented by the count specified in {n} (for "B{-1}", displays "B", "A", "-A", "-B").
"%1991{n}%" Displays numeric. The {n} indicates a count that the previous number is incremented by (for "1991{2}", displays "1991", "1993", "1995").
"%1991{-n}%" Displays numeric. The {-n} indicates a count that the previous number is decremented by (for "1991{-2}", displays "1991", "1989", "1987").
"\%" Displays special characters (reserved characters), the prefix is a backslash (\) (for "\%", displays "%").
"%%" No caption (same as "").
"\{" Displays braces, the prefix is a backslash (for "\{", displays "{").
"\\" Displays a backslash (\), the prefix is another backslash (\) (for "\\", displays "\").

If RowHeaderCell's Cell.Value is not a null reference (Nothing in Visual Basic) this property is invalid.

If RowHeaderCell's Cell.DataField property is not String.Empty when its owner GcMultiRow is bound, this property is invalid.

Example
The following code example shows some important properties of row header cells. The RowHeaderCell draws the appearance using the FlatAppearance. Because the ShowIndicator is false, the editing and new row icons are not displayed. Although the Row.ErrorText is set, the ShowRowError is false, so the error icon is not displayed in the RowHeaderCell. This code example is part of a larger example provided for the RowHeaderCell class.
private void Form1_Load(object sender, EventArgs e)
        {
            Template template1 = Template.CreateGridTemplate(10, 80, 21, Int32.MaxValue, AutoGenerateGridTemplateStyles.RowHeader, 50);
            //Set this property, an error icon glyph is displayed on the RowHeaderCell, if RowHeaderCell.ShowRowError is false, no icon is shown.
            template1.Row.ErrorText = "Row Error";

            RowHeaderCell rowHeaderCell1 = template1.Row.Cells[10] as RowHeaderCell;
            //Click the RowHeaderCell, the current row is selected.
            rowHeaderCell1.SelectionMode = MultiRowSelectionMode.Row;
            //Set FlatStyle to Flat, and customize the appearance.
            rowHeaderCell1.FlatStyle = FlatStyle.Flat;
            rowHeaderCell1.FlatAppearance.BorderColor = Color.Black;
            rowHeaderCell1.FlatAppearance.BorderSize = 1;
            rowHeaderCell1.FlatAppearance.MouseDownBackColor = Color.Khaki;
            rowHeaderCell1.FlatAppearance.MouseOverBackColor = Color.Orange;

            rowHeaderCell1.Style.BackColor = Color.DarkKhaki;
            rowHeaderCell1.Style.SelectionBackColor = Color.LightBlue;

            //The editing icon and new row icon do not display.
            rowHeaderCell1.ShowIndicator = false;
            //Set ShowRowError to false to hide the row's error icon.
            rowHeaderCell1.ShowRowError = false;
            //Set the RowHeaderCell's caption. It displays "A1, A2, A3, ...".
            rowHeaderCell1.ValueFormat = "A1";

            gcMultiRow1.Template = template1;
            gcMultiRow1.RowCount = 100;
        }
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        Dim template1 As Template = Template.CreateGridTemplate(10, 80, 21, Int32.MaxValue, AutoGenerateGridTemplateStyles.RowHeader, 50)
        'Set this property, an error icon glyph is displayed on the RowHeaderCell, if RowHeaderCell.ShowRowError is false, no icon is shown.
        template1.Row.ErrorText = "Row Error"

        Dim rowHeaderCell1 As RowHeaderCell = TryCast(template1.Row.Cells(10), RowHeaderCell)
        'Click the RowHeaderCell, the current row is selected.
        rowHeaderCell1.SelectionMode = MultiRowSelectionMode.Row
        'Set FlatStyle to Flat, and customize the appearance.
        rowHeaderCell1.FlatStyle = FlatStyle.Flat
        rowHeaderCell1.FlatAppearance.BorderColor = Color.Black
        rowHeaderCell1.FlatAppearance.BorderSize = 1
        rowHeaderCell1.FlatAppearance.MouseDownBackColor = Color.Khaki
        rowHeaderCell1.FlatAppearance.MouseOverBackColor = Color.Orange

        rowHeaderCell1.Style.BackColor = Color.DarkKhaki
        rowHeaderCell1.Style.SelectionBackColor = Color.LightBlue

        'The editing icon and new row icon do not display.
        rowHeaderCell1.ShowIndicator = False
        'Set ShowRowError to false to hide the row's error icon.
        rowHeaderCell1.ShowRowError = False
        'Set the RowHeaderCell's caption. It displays "A1, A2, A3, ...".
        rowHeaderCell1.ValueFormat = "A1"

        gcMultiRow1.Template = template1
        gcMultiRow1.RowCount = 100
    End Sub
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

RowHeaderCell Class
RowHeaderCell Members

 

 


Copyright © GrapeCity, inc. All rights reserved.