Skip to main content
Home Forums Silverlight Programming Programming with .NET - General Resize TabControl with Page_SizeChanged Event.
2 replies. Latest Post by NearDeath on December 9, 2008.
(0)
NearDeath
Member
0 points
7 Posts
12-08-2008 5:47 PM |
All, I am having an issue getting my tabcontrol to resize when the web browser is resized.
Here is the block of code doing the resizing... Basically what I am doing is calculating the percentage of screen change and then attempting to resize the control based on the percentage of screen change. If I don't put in any specific code to do the resizing of the tab control, it resizes the the tab control border only, but none of the content therein gets resized, such as textboxes, labels, and tabs themselves. I have a "UserControl" which has the tab control in it and I add the usercontrol to the root datagrid.
Currently, the below code kind of works, but for some odd reason, the tab control does not size correctly with the page resize. When you shrink the page, the tabcontrol is shrinking a lot more than the rest of the page percentage wise, so that the tab control on full size looks correct, but when shrinking, it no longer fills up the screen and just takes up a small portion of the screen that is left. It almost looks like my mathmatics below is wrong, but it looks right to me.
Any suggestions?
Thanks ahead of time... Maurice
e.NewSize.Height < _originalHeight)
{
PageScale.ScaleX = 1.0;
PageScale.ScaleY = 1.0;
}
PageScale.ScaleX = e.NewSize.Width / _originalWidth;
PageScale.ScaleY = e.NewSize.Height / _originalHeight;
cntrlScaleTransform.ScaleX = dbl_finalWidth;
cntrlScaleTransform.ScaleY = dbl_finalHeight;
m_tabCntrlMainContent.RenderTransform = cntrlScaleTransform;
Bigsby
262 points
81 Posts
12-08-2008 6:53 PM |
When the "filling" isn't correct, add a breakpoint in this part of the code and check the running numbers. You'll find there's Panel derived class (probably a Grid) that is not returning the correct values.
These classes are yet long from clean in Silverlight. For instance, I've found some cases where the Grid control returns different sizes depending on having or not a Background set.
12-09-2008 10:53 AM |