views:

25

answers:

1

My application is running on a touch-screen and it has a transparent main window, so only way to resize is using grip, but on the touch-screen it is quite hard to do. I wonder if there is a way to increase the size programmatically.

I have tried using custom commands but the window increases only by a small amount. Here is the code for my command:

private const int sizeIncreaseThreshold = 50;       
private double aspectRatio = 2.45;

private void IncreaseSizeExecuted(object sender, ExecutedRoutedEventArgs e)
{
  this.Width = this.Width + sizeIncreaseThreshold * aspectRatio;
  this.Height = this.Height + sizeIncreaseThreshold;
  e.Handled = true;
}
A: 

The code syntax above is correct, which means that the sizeIncreaseThreshold value must be small (for the height), or more likely, your aspect ratio is a value less than 1.

In other words, if your aspect ratio is 0.5, and the sizeIncreaseThreshold is 10, you are going to increase the Height by 10, but the width by 5, each time the command is executed.

Wonko the Sane
The problem is not the syntax, compiler checks for syntactical errors! I wouldn't be posting here a code with syntax error.
Vitalij
this.BackgroundColor = new SolidColorBrush(Colors.Red); will also compile, but is not syntactically correct for setting the size of the window. Perhaps you should read the *entire* answer (i.e. the only one you have thus far) and figure out why your values are incorrect, before ye cast judgement on the only person that tried to help you so far?
Wonko the Sane