RowHeight via code not working

5 posts, 0 answers
  1. James
    James avatar
    15 posts
    Member since:
    Feb 2016

    Posted 11 May Link to this post

    Given the following routine, can you please explain why I am not able to change the row height via code?

     

    With Me.dvAreas
     
                    .AllowColumnReorder = False
     
                    .AllowColumnResize = False
     
                    .AllowRowReorder = False
     
                    .AllowRowResize = False
     
                    .EnableAlternatingRowColor = True
     
                    .AutoSizeRows = False
     
                    .TableElement.GroupHeaderHeight = 50
     
                    .TableElement.RowHeight = 50
     
                    .TableElement.TableHeaderHeight = 50
     
                    Dim colID As New GridViewTextBoxColumn()
                    colID.Name = "colID"
                    colID.HeaderText = "Work Area ID"
                    colID.FieldName = "WorkAreaID"
                    colID.MaxLength = 0
                    colID.TextAlignment = ContentAlignment.MiddleRight
                    colID.IsVisible = False
                    colID.Width = 0
     
                    Dim colWorkAreaName As New GridViewTextBoxColumn()
                    colWorkAreaName.Name = "WorkAreaName"
                    colWorkAreaName.HeaderText = "Name"
                    colWorkAreaName.FieldName = "WorkAreaName"
                    colWorkAreaName.MaxLength = 15
                    colWorkAreaName.TextAlignment = ContentAlignment.MiddleLeft
                    colWorkAreaName.IsVisible = True
                    colWorkAreaName.Width = 100
     
                    Dim colWallConstructionMasonry As New GridViewCheckBoxColumn()
                    colWallConstructionMasonry.Name = "WCMasonry"
                    colWallConstructionMasonry.HeaderText = "Masonry"
                    colWallConstructionMasonry.FieldName = "WCMasonry"
                    colWallConstructionMasonry.TextAlignment = ContentAlignment.MiddleLeft
                    colWallConstructionMasonry.IsVisible = True
                    colWallConstructionMasonry.Width = 100
     
                    Dim colWallConstructionSteel As New GridViewCheckBoxColumn()
                    colWallConstructionSteel.Name = "WCSteel"
                    colWallConstructionSteel.HeaderText = "Steel"
                    colWallConstructionSteel.FieldName = "WCSteel"
                    colWallConstructionSteel.TextAlignment = ContentAlignment.MiddleLeft
                    colWallConstructionSteel.IsVisible = True
                    colWallConstructionSteel.Width = 100
     
                    Dim colWallConstructionOther As New GridViewCheckBoxColumn()
                    colWallConstructionOther.Name = "WCOther"
                    colWallConstructionOther.HeaderText = "Other"
                    colWallConstructionOther.FieldName = "WCOther"
                    colWallConstructionOther.TextAlignment = ContentAlignment.MiddleLeft
                    colWallConstructionOther.IsVisible = True
                    colWallConstructionOther.Width = 100
     
                    .MasterTemplate.Columns.Add(colID)
                    .MasterTemplate.Columns.Add(colWorkAreaName)
                    .MasterTemplate.Columns.Add(colWallConstructionMasonry)
                    .MasterTemplate.Columns.Add(colWallConstructionSteel)
                    .MasterTemplate.Columns.Add(colWallConstructionOther)
     
                    Dim view As New ColumnGroupsViewDefinition()
                    view.ColumnGroups.Add(New GridViewColumnGroup("Work Area"))
                    view.ColumnGroups.Add(New GridViewColumnGroup("Wall Construction"))
     
                    view.ColumnGroups(0).Rows.Add(New GridViewColumnGroupRow())
                    view.ColumnGroups(0).Rows(0).ColumnNames.Add("WorkAreaName")
     
                    view.ColumnGroups(1).Rows.Add(New GridViewColumnGroupRow())
                    view.ColumnGroups(1).Rows(0).ColumnNames.Add("WCMasonry")
                    view.ColumnGroups(1).Rows(0).ColumnNames.Add("WCSteel")
                    view.ColumnGroups(1).Rows(0).ColumnNames.Add("WCOther")
     
     
     
                    .ViewDefinition = view
             

  2. James
    James avatar
    15 posts
    Member since:
    Feb 2016

    Posted 11 May Link to this post

    Nevermind... afte some searching and trial and error, is discovered RowSpan...  this did the trick for me.

     

    With Me.dvAreas

     

                    .AllowColumnReorder = False
     
                    .AllowColumnResize = False
     
                    .AllowRowReorder = False
     
                    .AllowRowResize = False
     
                    .AutoSizeRows = False
     
                    .EnableAlternatingRowColor = True
     
                    .ShowGroupPanel = False
     
                    .TableElement.GroupHeaderHeight = 50
     
                    .TableElement.RowHeight = 50
     
                    .TableElement.TableHeaderHeight = 50
     
                    Dim colID As New GridViewTextBoxColumn()
                    colID.Name = "colID"
                    colID.HeaderText = "Work Area ID"
                    colID.FieldName = "WorkAreaID"
                    colID.MaxLength = 0
                    colID.TextAlignment = ContentAlignment.MiddleRight
                    colID.IsVisible = False
                    colID.RowSpan = intGridRowDefaultHeight
                    colID.Width = 0
     
                    .MasterTemplate.Columns.Add(colID)
     
                    Dim colWorkAreaName As New GridViewTextBoxColumn()
                    colWorkAreaName.Name = "WorkAreaName"
                    colWorkAreaName.HeaderText = "Name"
                    colWorkAreaName.FieldName = "WorkAreaName"
                    colWorkAreaName.MaxLength = 15
                    colWorkAreaName.TextAlignment = ContentAlignment.MiddleLeft
                    colWorkAreaName.IsVisible = True
                    colWorkAreaName.RowSpan = intGridRowDefaultHeight
                    colWorkAreaName.Width = 100
     
     
                    .MasterTemplate.Columns.Add(colWorkAreaName)
     
                    Dim colWallConstructionMasonry As New GridViewCheckBoxColumn()
                    colWallConstructionMasonry.Name = "WCMasonry"
                    colWallConstructionMasonry.HeaderText = "Masonry"
                    colWallConstructionMasonry.FieldName = "WCMasonry"
                    colWallConstructionMasonry.TextAlignment = ContentAlignment.MiddleLeft
                    colWallConstructionMasonry.IsVisible = True
                    colWallConstructionMasonry.RowSpan = intGridRowDefaultHeight
                    colWallConstructionMasonry.Width = 75
     
                    .MasterTemplate.Columns.Add(colWallConstructionMasonry)
     
                    Dim colWallConstructionSteel As New GridViewCheckBoxColumn()
                    colWallConstructionSteel.Name = "WCSteel"
                    colWallConstructionSteel.HeaderText = "Steel"
                    colWallConstructionSteel.FieldName = "WCSteel"
                    colWallConstructionSteel.TextAlignment = ContentAlignment.MiddleLeft
                    colWallConstructionSteel.IsVisible = True
                    colWallConstructionSteel.RowSpan = intGridRowDefaultHeight
                    colWallConstructionSteel.Width = 75
     
                    .MasterTemplate.Columns.Add(colWallConstructionSteel)
     
                    Dim colWallConstructionOther As New GridViewCheckBoxColumn()
                    colWallConstructionOther.Name = "WCOther"
                    colWallConstructionOther.HeaderText = "Other"
                    colWallConstructionOther.FieldName = "WCOther"
                    colWallConstructionOther.TextAlignment = ContentAlignment.MiddleLeft
                    colWallConstructionOther.IsVisible = True
                    colWallConstructionOther.RowSpan = intGridRowDefaultHeight
                    colWallConstructionOther.Width = 75
     
                    .MasterTemplate.Columns.Add(colWallConstructionOther)
     
                    Dim colCracksLength As New GridViewDecimalColumn()
                    colCracksLength.Name = "CracksLength"
                    colCracksLength.DecimalPlaces = 0
                    colCracksLength.HeaderText = "Length (LF)"
                    colCracksLength.FieldName = "CracksLength"
                    colCracksLength.Minimum = intCracksLengthMinimumValue
                    colCracksLength.Maximum = intCracksLengthMaximumValue
                    colCracksLength.ShowUpDownButtons = False
                    colCracksLength.TextAlignment = ContentAlignment.MiddleRight
                    colCracksLength.IsVisible = True
                    colCracksLength.RowSpan = intGridRowDefaultHeight
                    colCracksLength.Width = 75
     
                    .MasterTemplate.Columns.Add(colCracksLength)
     
                    Dim colBlankOpeningLength As New GridViewDecimalColumn()
                    colBlankOpeningLength.Name = "BlankOpeningLength"
                    colBlankOpeningLength.DecimalPlaces = 0
                    colBlankOpeningLength.HeaderText = "Length (IN)"
                    colBlankOpeningLength.FieldName = "BlankOpeningLength"
                    colBlankOpeningLength.Minimum = intBlankOpeningGroupLengthMinimumValue
                    colBlankOpeningLength.Maximum = intBlankOpeningGroupLengthMaximumValue
                    colBlankOpeningLength.ShowUpDownButtons = False
                    colBlankOpeningLength.TextAlignment = ContentAlignment.MiddleRight
                    colBlankOpeningLength.IsVisible = True
                    colBlankOpeningLength.RowSpan = intGridRowDefaultHeight
                    colBlankOpeningLength.Width = 75
     
                    .MasterTemplate.Columns.Add(colBlankOpeningLength)
     
                    Dim colBlankOpeningWidth As New GridViewDecimalColumn()
                    colBlankOpeningWidth.Name = "BlankOpeningWidth"
                    colBlankOpeningWidth.DecimalPlaces = 0
                    colBlankOpeningWidth.HeaderText = "Width (IN)"
                    colBlankOpeningWidth.FieldName = "BlankOpeningWidth"
                    colBlankOpeningWidth.Minimum = intBlankOpeningGroupWidthMinimumValue
                    colBlankOpeningWidth.Maximum = intBlankOpeningGroupWidthMaximumValue
                    colBlankOpeningWidth.ShowUpDownButtons = False
                    colBlankOpeningWidth.TextAlignment = ContentAlignment.MiddleRight
                    colBlankOpeningWidth.IsVisible = True
                    colBlankOpeningWidth.RowSpan = intGridRowDefaultHeight
                    colBlankOpeningWidth.Width = 75
     
                    .MasterTemplate.Columns.Add(colBlankOpeningWidth)
     
                    Dim colBlankOpeningDiameter As New GridViewDecimalColumn()
                    colBlankOpeningDiameter.Name = "BlankOpeningDiameter"
                    colBlankOpeningDiameter.DecimalPlaces = 0
                    colBlankOpeningDiameter.HeaderText = "Diameter (IN)"
                    colBlankOpeningDiameter.FieldName = "BlankOpeningDiameter"
                    colBlankOpeningDiameter.Minimum = intBlankOpeningGroupDiameterMinimumValue
                    colBlankOpeningDiameter.Maximum = intBlankOpeningGroupDiameterMaximumValue
                    colBlankOpeningDiameter.ShowUpDownButtons = False
                    colBlankOpeningDiameter.TextAlignment = ContentAlignment.MiddleRight
                    colBlankOpeningDiameter.IsVisible = True
                    colBlankOpeningDiameter.Width = 75
     
                    .MasterTemplate.Columns.Add(colBlankOpeningDiameter)
     
                    Dim colBlankOpeningQuantity As New GridViewDecimalColumn()
                    colBlankOpeningQuantity.Name = "BlankOpeningQuantity"
                    colBlankOpeningQuantity.DecimalPlaces = 0
                    colBlankOpeningQuantity.HeaderText = "Quantity (EA)"
                    colBlankOpeningQuantity.FieldName = "BlankOpeningQuantity"
                    colBlankOpeningQuantity.Minimum = intBlankOpeningGroupQuantityMinimumValue
                    colBlankOpeningQuantity.Maximum = intBlankOpeningGroupQuantityMaximumValue
                    colBlankOpeningQuantity.ShowUpDownButtons = False
                    colBlankOpeningQuantity.TextAlignment = ContentAlignment.MiddleRight
                    colBlankOpeningQuantity.IsVisible = True
                    colBlankOpeningQuantity.Width = 75
     
                    .MasterTemplate.Columns.Add(colBlankOpeningQuantity)
     
                    Dim colPenetrationsLength As New GridViewDecimalColumn()
                    colPenetrationsLength.Name = "PenetrationsLength"
                    colPenetrationsLength.DecimalPlaces = 0
                    colPenetrationsLength.HeaderText = "Length (IN)"
                    colPenetrationsLength.FieldName = "PenetrationsLength"
                    colPenetrationsLength.Minimum = intPenetrationsGroupLengthMinimumValue
                    colPenetrationsLength.Maximum = intPenetrationsGroupLengthMaximumValue
                    colPenetrationsLength.ShowUpDownButtons = False
                    colPenetrationsLength.TextAlignment = ContentAlignment.MiddleRight
                    colPenetrationsLength.IsVisible = True
                    colPenetrationsLength.Width = 75
     
                    .MasterTemplate.Columns.Add(colPenetrationsLength)
     
                    Dim colPenetrationsWidth As New GridViewDecimalColumn()
                    colPenetrationsWidth.Name = "PenetrationsWidth"
                    colPenetrationsWidth.DecimalPlaces = 0
                    colPenetrationsWidth.HeaderText = "Width (IN)"
                    colPenetrationsWidth.FieldName = "PenetrationsWidth"
                    colPenetrationsWidth.Minimum = intPenetrationsGroupWidthMinimumValue
                    colPenetrationsWidth.Maximum = intPenetrationsGroupWidthMaximumValue
                    colPenetrationsWidth.ShowUpDownButtons = False
                    colPenetrationsWidth.TextAlignment = ContentAlignment.MiddleRight
                    colPenetrationsWidth.IsVisible = True
                    colPenetrationsWidth.Width = 75
     
                    .MasterTemplate.Columns.Add(colPenetrationsWidth)
     
                    Dim colPenetrationsDiameter As New GridViewDecimalColumn()
                    colPenetrationsDiameter.Name = "PenetrationsDiameter"
                    colPenetrationsDiameter.DecimalPlaces = 0
                    colPenetrationsDiameter.HeaderText = "Diameter (IN)"
                    colPenetrationsDiameter.FieldName = "PenetrationsDiameter"
                    colPenetrationsDiameter.Minimum = intPenetrationsGroupDiameterMinimumValue
                    colPenetrationsDiameter.Maximum = intPenetrationsGroupDiameterMaximumValue
                    colPenetrationsDiameter.ShowUpDownButtons = False
                    colPenetrationsDiameter.TextAlignment = ContentAlignment.MiddleRight
                    colPenetrationsDiameter.IsVisible = True
                    colPenetrationsDiameter.Width = 75
     
                    .MasterTemplate.Columns.Add(colPenetrationsDiameter)
     
                    Dim colPenetrationsQuantity As New GridViewDecimalColumn()
                    colPenetrationsQuantity.Name = "PenetrationsQuantity"
                    colPenetrationsQuantity.DecimalPlaces = 0
                    colPenetrationsQuantity.HeaderText = "Quantity (EA)"
                    colPenetrationsQuantity.FieldName = "PenetrationsQuantity"
                    colPenetrationsQuantity.Minimum = intPenetrationsGroupQuantityMinimumValue
                    colPenetrationsQuantity.Maximum = intPenetrationsGroupQuantityMaximumValue
                    colPenetrationsQuantity.ShowUpDownButtons = False
                    colPenetrationsQuantity.TextAlignment = ContentAlignment.MiddleRight
                    colPenetrationsQuantity.IsVisible = True
                    colPenetrationsQuantity.Width = 75
     
                    .MasterTemplate.Columns.Add(colPenetrationsQuantity)
     
                    Dim view As New ColumnGroupsViewDefinition()
     
                    view.ColumnGroups.Add(New GridViewColumnGroup("Work Area"))
                    view.ColumnGroups(0).Rows.Add(New GridViewColumnGroupRow())
                    view.ColumnGroups(0).Rows(0).ColumnNames.Add("WorkAreaName")
                    view.ColumnGroups(0).RowSpan = intGridRowDefaultHeight
     
                    view.ColumnGroups.Add(New GridViewColumnGroup("Wall Construction"))
                    view.ColumnGroups(1).Rows.Add(New GridViewColumnGroupRow())
                    view.ColumnGroups(1).Rows(0).ColumnNames.Add("WCMasonry")
                    view.ColumnGroups(1).Rows(0).ColumnNames.Add("WCSteel")
                    view.ColumnGroups(1).Rows(0).ColumnNames.Add("WCOther")
                    view.ColumnGroups(1).RowSpan = intGridRowDefaultHeight
     
                    view.ColumnGroups.Add(New GridViewColumnGroup("Cracks"))
                    view.ColumnGroups(2).Rows.Add(New GridViewColumnGroupRow())
                    view.ColumnGroups(2).Rows(0).ColumnNames.Add("CracksLength")
                    view.ColumnGroups(2).RowSpan = intGridRowDefaultHeight
     
                    view.ColumnGroups.Add(New GridViewColumnGroup("Blank Opening"))
                    view.ColumnGroups(3).Rows.Add(New GridViewColumnGroupRow())
                    view.ColumnGroups(3).Rows(0).ColumnNames.Add("BlankOpeningLength")
                    view.ColumnGroups(3).Rows(0).ColumnNames.Add("BlankOpeningWidth")
                    view.ColumnGroups(3).Rows(0).ColumnNames.Add("BlankOpeningDiameter")
                    view.ColumnGroups(3).Rows(0).ColumnNames.Add("BlankOpeningQuantity")
                    view.ColumnGroups(3).RowSpan = intGridRowDefaultHeight
     
                    view.ColumnGroups.Add(New GridViewColumnGroup("Penetrations"))
                    view.ColumnGroups(4).Rows.Add(New GridViewColumnGroupRow())
                    view.ColumnGroups(4).Rows(0).ColumnNames.Add("PenetrationsLength")
                    view.ColumnGroups(4).Rows(0).ColumnNames.Add("PenetrationsWidth")
                    view.ColumnGroups(4).Rows(0).ColumnNames.Add("PenetrationsDiameter")
                    view.ColumnGroups(4).Rows(0).ColumnNames.Add("PenetrationsQuantity")
                    view.ColumnGroups(4).RowSpan = intGridRowDefaultHeight
     
                    .ViewDefinition = view
     
                End With

     

  3. UI for WinForms is Visual Studio 2017 Ready
  4. Hristo
    Admin
    Hristo avatar
    714 posts

    Posted 12 May Link to this post

    Hello James,

    Thank you for writing.

    I am glad that you have managed to achieve your task.

    Please let me know if you need further assistance.

    Regards,
    Hristo Merdjanov
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  5. James
    James avatar
    15 posts
    Member since:
    Feb 2016

    Posted 12 May in reply to Hristo Link to this post

    Unfortunately, I spoke too soon.

    See attached image...  how can I have the header rows and the main grid rows at two different heights?

     

     

  6. Hristo
    Admin
    Hristo avatar
    714 posts

    Posted 13 May Link to this post

    Hi James,

    Thank you for writing back.

    Basically, you would need to work with the RowSpan and MinHeight properties. Could you please check the following forum thread and see if the suggested solution would fit your setup: http://www.telerik.com/forums/radgridview-rowheight#FWSCdTh7K0ufOjF-VMCP8g.

    I hope this helps. Please let me know if you still need assistance.

    Regards,
    Hristo Merdjanov
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top
UI for WinForms is Visual Studio 2017 Ready