We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Custom properties in a custom cell

Hi all, I've created a custom cell type, which has some properties the user can configure at design time. At runtime, I want to access the values of this properties from the OnDraw method on the renderer class for the cell to get the value of this properties. I can see it is stored under the CustomProperties of the style object I receive as a parameter, but I can't access that value. Is there any other way?

3 Replies

AD Administrator Syncfusion Team October 15, 2003 11:04 AM

Check out the Grid\Samples\CellTypes\SliderCells example and/or also PictureBoxCells. You have to attach the GridStyleInfo object to your custom properties class. Example: public static void InitializeSlider(TrackBar c, GridStyleInfo style) { SliderStyleProperties sp = new SliderStyleProperties(style); // Now, access SliderStyleProperties through sp ... Stefan


AD Alberto del Barrio October 15, 2003 11:00 PM

OK, I've already done that, but the thing is with that code I can assign the values I have in my custom properties to the instance of my control I use internally; public static void InicializarFecha(Fecha fechaLista, GridStyleInfo style) { FechaListaProperties fechaProp = new FechaListaProperties(style); fechaLista.ModeloControl.Valor = fechaProp.Valor; fechaLista.ModeloControl.Formato = fechaProp.Formato; InicializarFecha(fechaLista,style.CellValue); } Now, how can I assign values to that properties depending on user configuration? Because otherwise I'll be always using the values of the properties set for the default object Thanks


AD Administrator Syncfusion Team October 16, 2003 03:44 AM

Is your question, how do you initialize these special style properties depending upon the cell? Going back to the slider example, when you want to set the special slider properties depending upon a particular cell, you use this code from main.cs. style = gridControl1[row, 3]; sp = new SliderStyleProperties(style); style.CellType = "Slider"; sp.Maximum = 40; sp.Minimum = 0; sp.TickFrequency = 8; sp.LargeChange = 16; sp.SmallChange = 4; Then in your custom cell code, when the cell is (row, 3), these will be the values used in InitializeSlider(TrackBar c, GridStyleInfo style) to set the state for the TrackBar c depending on the values in the style.

Loader.
Live Chat Icon For mobile
Up arrow icon