✅ Issues with window resizing

Hello, I have this code:
public partial class MainWindow : Window
{
private int Seed;
double WorldHeight { get; set; }
double WorldWidth { get; set; }
public MainWindow()
{
InitializeComponent();
Seed = new Random().Next(1,1000);
GenerateWorld();

}
private void GenerateWorld()
{
WorldHeight = Math.Round(Height / Tile.Size);
WorldWidth = Math.Round(Width / Tile.Size);
Random random = new Random(Seed);
for(int i = 0; i < WorldHeight; i++)
{
for(int j = 0; j < WorldWidth; j++)
{
TileType type = new TileType[] { TileType.Stone, TileType.Grass }[random.Next(0, 2)];
Tile tile = new Tile(Convert.ToDouble(j),Convert.ToDouble(i),type);
Display.Children.Add(tile);
}
}
}
private void OnWindowResize(object sender, EventArgs e)
{
Display.Children.Clear();
GenerateWorld();
}
}
public partial class MainWindow : Window
{
private int Seed;
double WorldHeight { get; set; }
double WorldWidth { get; set; }
public MainWindow()
{
InitializeComponent();
Seed = new Random().Next(1,1000);
GenerateWorld();

}
private void GenerateWorld()
{
WorldHeight = Math.Round(Height / Tile.Size);
WorldWidth = Math.Round(Width / Tile.Size);
Random random = new Random(Seed);
for(int i = 0; i < WorldHeight; i++)
{
for(int j = 0; j < WorldWidth; j++)
{
TileType type = new TileType[] { TileType.Stone, TileType.Grass }[random.Next(0, 2)];
Tile tile = new Tile(Convert.ToDouble(j),Convert.ToDouble(i),type);
Display.Children.Add(tile);
}
}
}
private void OnWindowResize(object sender, EventArgs e)
{
Display.Children.Clear();
GenerateWorld();
}
}
My issue is that the OnWindowResize() is not triggered when fullsreening the app
5 Replies
Mąż Zuzanny Harmider Szczęście
nvm, just added StateChanged to mainwindow !solved
MODiX
MODiX6d ago
That command had an error
UnknownCommand: Unknown command.
Remove your reaction to delete this message
Buddy
Buddy6d ago
$close
MODiX
MODiX6d ago
If you have no further questions, please use /close to mark the forum thread as answered

Did you find this page helpful?