This is a migrated thread and some comments may be shown as answers.

2009 Problem

3 Answers 64 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Christopher Bishop
Top achievements
Rank 2
Christopher Bishop asked on 12 Mar 2009, 09:15 PM

If you go Edit UI and change the column header bgcolor it breaks the grid (invalid index)

It puts this in the designer code:

 

CType

 

(Me.radDataList.GetChildAt(0).GetChildAt(1).GetChildAt(0).GetChildAt(0), Telerik.WinControls.UI.GridHeaderCellElement).BackColor2 = System.Drawing.Color.FromArgb(CType(CType(232, Byte), Integer), CType(CType(241, Byte), Integer), CType(CType(251, Byte), Integer))

I would use the theme builder but it is barely working now (2009), wont let me change images on anything (button doesn't work) have to add it to the xml file instead, and the theme builder doesn't do any changes to headers even if i change the XML file
IE:
          <XmlPropertySettingGroup>
            <PropertySettings>
              <XmlPropertySetting Property="Telerik.WinControls.UI.LightVisualElement.GradientStyle" Value="Linear" />
              <XmlPropertySetting Property="Telerik.WinControls.UI.LightVisualElement.GradientAngle" Value="90" />
              <XmlPropertySetting Property="Telerik.WinControls.UI.LightVisualElement.GradientPercentage" Value="0.3152455" />
              <XmlPropertySetting Property="Telerik.WinControls.UI.LightVisualElement.GradientPercentage2" Value="0.3333333" />
              <XmlPropertySetting Property="Telerik.WinControls.VisualElement.BackColor" Value="243, 242, 237" />
              <XmlPropertySetting Property="Telerik.WinControls.UI.LightVisualElement.BackColor2" Value="243, 242, 237" />
              <XmlPropertySetting Property="Telerik.WinControls.UI.LightVisualElement.BackColor3" Value="243, 242, 237" />
              <XmlPropertySetting Property="Telerik.WinControls.UI.LightVisualElement.BackColor4" Value="243, 242, 237" />
              <XmlPropertySetting Property="Telerik.WinControls.UI.LightVisualElement.NumberOfColors" Value="4" />
              <XmlPropertySetting Property="Telerik.WinControls.UI.LightVisualElement.DrawFill" Value="True" />
              <XmlPropertySetting Property="Telerik.WinControls.UI.LightVisualElement.BorderColor" Value="222, 215, 222" />
              <XmlPropertySetting Property="Telerik.WinControls.VisualElement.SmoothingMode" Value="AntiAlias" />
              <XmlPropertySetting Property="Telerik.WinControls.UI.LightVisualElement.DrawBorder" Value="True" />
              <XmlPropertySetting Property="Telerik.WinControls.UI.LightVisualElement.BorderGradientStyle" Value="Solid" />
              <XmlPropertySetting Property="Telerik.WinControls.VisualElement.ForeColor" Value="103, 167, 227" />
            </PropertySettings>
            <Selectors>
              <XmlClassSelector ElementClass="HeaderCell" />
            </Selectors>
          </XmlPropertySettingGroup>

Any thoughts?

 

3 Answers, 1 is accepted

Sort by
0
Accepted
Mike
Telerik team
answered on 13 Mar 2009, 06:07 PM
Hello Christopher Bishop,

The best approach to modifying heder cell appearance would be to handle grid's ViewCellFormatting event and set the properties of the visual element corresponding to the arguments of the event. Here you can find more on the topic (note: the CellFormatting event is not available for HeaderCell, you should use ViewCellFormatting event ):
http://www.telerik.com/help/winforms/formatting_cells.html

The Edit UI elements option fails in case of RadGridView, as the structure of visual elements is not available until the grid is bound to dat, which occurs after the InitializeComponent method. We are aware of the issue and we have scheduled it for fixing in the next release. But even if you cut/paste the code in a method that executes after grid is bound to data, header cell format might be lost, when grid recreated the UI elements, after resizing, scrolling or any other event. This is why we have introduced the Cel/RowlFormatting events.

As it comes to theming, even though it is possible to style each grid UI element, including header cells, with theme I would not reccoment using this approach it is designed for styling controls at a higher level - i.e. all instances of the component in the application, independent on the particular instance. However, let me know if you are interested in using the approach.

Let me know if you need  assistance further with this issue.

Regards,
Mike
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Christopher Bishop
Top achievements
Rank 2
answered on 13 Mar 2009, 08:28 PM
In hindsite you should probally just remove the edit ui option in design view to avoid this problem all together.

The only reason I use themes is so I don't have to code the events etc. on a per grid basis when they all
use the exact same style across the board it is one of the things i love about telerik, it is a little upseting
to see you guys kill it in this new version and make me actually code it.

I programmed in the suggestion and it works fine but is kind of a pain even know I just through it in a global
sub that they can all access (just pass grid) and I also notice that the headers sometimes disapear or
rather just ignore the formating all together. Not sure what is with that but if I add/remove a column via
column chooser it resets the grid but doesn't reapply my formating (any thoughts?) the event doesn't
get fired when adding/remove columns.
0
Mike
Telerik team
answered on 16 Mar 2009, 04:37 PM
Hello Christopher Bishop,

Can you please share the code you are using to customize the grid in this case? You can post it here or open a support ticket (where you can attach files), as you prefer.

Greetings,
Mike
the Telerik team


Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
GridView
Asked by
Christopher Bishop
Top achievements
Rank 2
Answers by
Mike
Telerik team
Christopher Bishop
Top achievements
Rank 2
Share this question
or