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
.