The Width
property of the screen doesn't seem to update to the fully maximized width when maximizing a window. If I resize it everything works fine, but not when maximizing.
The code I have is as follows:
private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
{
UpdateColumns();
}
private void button1_Click(object sender, RoutedEventArgs e)
{
UpdateColumns();
}
private void UpdateColumns()
{
ColumnCount = Math.Round(Width/150);
statusBarItemColumnCount.Content = ColumnCount;
button1.Content = ColumnCount + " " + Width;
}
private void Window_StateChanged(object sender, EventArgs e)
{
UpdateColumns();
}
Take a look at ActualWidth
, rather than Width
.
try using ActualWidth
instead of Width
, that should fix it
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With