hi!
i need to replicate the filedialog (vista style) and i cant seem to get the icon of a row to be in the same cell as the text (the Name column in the filedialog contains both an icon and the file name).
How could i mimic this? and coult it be done with an ImageList index istead of an actual Bitmap?
Thanks
-jorge
3 Answers, 1 is accepted
0
Hello Jorge Delgado-Lopez,
Thank you for your question. Please see the sample code below:
Do not hesitate to write me back if you have more questions.
Kind regards,
Nick
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Thank you for your question. Please see the sample code below:
private void Form1_Load(object sender, EventArgs e) |
{ |
GridViewDataColumn c = new GridViewDataColumn(); |
this.radGridView1.Columns.Add(c); |
for (int i = 0; i < 10; i++) { |
this.radGridView1.Rows.AddNew(); |
} |
} |
private void radButton1_Click(object sender, EventArgs e) |
{ |
} |
private void radGridView1_CellFormatting(object sender, CellFormattingEventArgs e) |
{ |
e.CellElement.Image= Image.FromFile("testimage3.jpg"); |
e.CellElement.Text = "some text"; |
e.CellElement.TextImageRelation = TextImageRelation.ImageBeforeText; |
e.CellElement.ImageLayout = ImageLayout.Center; |
} |
Do not hesitate to write me back if you have more questions.
Kind regards,
Nick
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
superold
Top achievements
Rank 1
answered on 17 Dec 2008, 06:04 PM
thanks. almost there.
The text and image are horizontally center aligned. When the column is wider than the content (image+text) it centers.
How can i horizontal align left?
I have set these properties:
e.CellElement.TextImageRelation = TextImageRelation.ImageBeforeText;
e.CellElement.TextAlignment = ContentAlignment.MiddleLeft;
Thanks,
-j
0
Hello Jorge Delgado-Lopez,
This will be available for the next Service Pack in January. The code that will work with the upcoming release is the following:
Do not hesitate to write me back if you have more questions.
Sincerely yours,
Nick
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
This will be available for the next Service Pack in January. The code that will work with the upcoming release is the following:
e.CellElement.Image = Image.FromFile("testimage3.jpg"); |
e.CellElement.Text = "some text"; |
e.CellElement.TextImageRelation = TextImageRelation.ImageBeforeText; |
//ImageLayout has to be set to none: |
e.CellElement.ImageLayout = ImageLayout.None; |
e.CellElement.ImageAlignment = ContentAlignment.MiddleLeft; |
e.CellElement.TextAlignment = ContentAlignment.MiddleLeft; |
Do not hesitate to write me back if you have more questions.
Sincerely yours,
Nick
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.