Is it possible to do something like a row magnifier effect for the grid? Something like on some mouse's zoom button but for the current row? I think it would be pretty cool to have something like that so the text on the current row could be easier to read, especially if small font was used for the grid to fit all the data needed.
Just a little candy for us little kids :)
Phi
Just a little candy for us little kids :)
Phi
4 Answers, 1 is accepted
0

Phi
Top achievements
Rank 1
answered on 03 Nov 2010, 03:28 AM
I tried the following code to increase the font size of the current row in the grid without success. None of the cells has Style!!! I noticed that the grid has Style property but not sure how to use it!
private
Font ChangeFontSize(Font font,
float
sizeChange)
{
return
new
Font(font.FontFamily, font.Size + sizeChange);
}
private
void
ChangeFontSize(GridViewRowInfo row,
float
sizeChange)
{
foreach
(GridViewCellInfo cell
in
row.Cells)
{
if
(cell.HasStyle)
cell.Style.Font = ChangeFontSize(cell.Style.Font, sizeChange);
}
}
private
void
gridView_CurrentRowChanged(
object
sender, CurrentRowChangedEventArgs e)
{
if
(e.OldRow !=
null
)
ChangeFontSize(e.OldRow, -3F);
if
(e.CurrentRow !=
null
)
ChangeFontSize(e.CurrentRow, 3F);
}
0

Phi
Top achievements
Rank 1
answered on 03 Nov 2010, 03:58 AM
I read up on other threads in regard to style and tried to do the same in RowFormatting event. But some how the ResetValue does not seem to work with FontProperty. My current row's font size keeps getting bigger and bigger after each time!!!
private
void
gridView_RowFormatting(
object
sender, RowFormattingEventArgs e)
{
if
(e.RowElement.RowInfo.IsCurrent)
{
e.RowElement.Font = ChangeFontSize(e.RowElement.Font, 2);
}
else
{
e.RowElement.ResetValue(LightVisualElement.FontProperty, ValueResetFlags.Local);
}
}
0

Phi
Top achievements
Rank 1
answered on 03 Nov 2010, 05:02 AM
I resorted to used fixed size font for current row and a different fixed but smaller font for the other rows. That seems to work better. With the AutoRowSized property turned on, it works pretty good!\
private
Font GetLargeFontSize(Font font)
{
return
new
Font(font.FontFamily, 9.75F);
}
private
Font RestoreFontSize(Font font)
{
return
new
Font(font.FontFamily, 8.25F);
}
private
void
gridView_RowFormatting(
object
sender, RowFormattingEventArgs e)
{
if
(e.RowElement.RowInfo.IsCurrent)
{
e.RowElement.Font = GetLargeFontSize(e.RowElement.Font);
}
else
{
//e.RowElement.ResetValue(LightVisualElement.FontProperty, ValueResetFlags.Local);
e.RowElement.Font = RestoreFontSize(e.RowElement.Font);
}
}
0
Hello Phi,
I am glad to hear that you have managed to find a solution for your scenario. If you have further questions, feel free to write back.
Greetings,
Svett
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items