0

Is there a way to resize controls, such as a button, instantaniously with the window being resized?
Currently, I am using a button click method to resize using this code:

UpdateLayout();
addButton.Height = this.Height / 30;

2
Contributors
5
Replies
18
Views
5 Months
Discussion Span
Last Post by rproffitt
0

thank you.. here is code if anyone in future looks at this and needs help

xaml code in the window ===> SizeChanged="AddInfoToStudyBuddy_Resize"
.cs code:

private void AddInfoToStudyBuddy_Resize(object sender, SizeChangedEventArgs e)
[
addButton.Height = this.Height / 20;
tabControl.Height = this.Height - 150;
tabControl.Width = this.Width - 100;
question.Width = this.Width - 130;
question.Height += this.Height / 30;
]

Edited by jigglymig

0

WARNING. I should have noted this. Be sure to test that "this" dimensions are not zero. That is, what size is this when the app is minimized?

I didn't account for this and my demo crashed when an user did that. I knew what it was but due to the rush to get the demo working (it was a demo) I hadn't coded for this instance.

0

No worries, It minimizes alright and no issues. I'm guessing it was fixed with later releases

1

Be sure to test it harder. Grab a corner and make it tiny. Some controls don't like the negativity.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.