Mąż Zuzanny Harmider Szczęście
Mąż Zuzanny Harmider Szczęście
CC#
Created by Mąż Zuzanny Harmider Szczęście on 2/26/2025 in #help
Binding doesn't update for some reason
Hey, i'm having some wierd issues with binding not updating in wpf, here's the relevant code: (the issue is that the item count in the player inventory doesn't update on display) TradeView.xaml (lines 23-48) TradeViewViewModel (lines 49-59) PlayerViewModel InventoryViewModel ItemViewModel ViewModelBase
35 replies
CC#
Created by Mąż Zuzanny Harmider Szczęście on 2/22/2025 in #help
✅ Help with wpf binding issues
Hey guys, im having issues with wpf binding again... would be nice to get some help: code
42 replies
CC#
Created by Mąż Zuzanny Harmider Szczęście on 2/13/2025 in #help
✅ Code improvement
Hey guys, just wondering if there's a better way to do the function i did.
21 replies
CC#
Created by Mąż Zuzanny Harmider Szczęście on 2/1/2025 in #help
Problem with binding
Hey guys, im having issues with binding in this code: https://paste.mod.gg/bxttdnuopcri/4 i started doing my game from the start to make it easier to code later
103 replies
CC#
Created by Mąż Zuzanny Harmider Szczęście on 1/28/2025 in #help
✅ World generation optimization
Hey guys, i'm having issues with world generation for my game, do you guys know how i could optimize it? it takes 15s for the window to load rn
104 replies
CC#
Created by Mąż Zuzanny Harmider Szczęście on 1/24/2025 in #help
✅ Issues with wpf binding
Hey guys, i'm having some issues with bindining a number Score to a Label in wpf, here's my code:
public partial class MainWindow : Window
{
public static int Score { get; set; } = 10;
public static int Seed { get; set; }
double WorldHeight { get; set; }
double WorldWidth { get; set; }

public MainWindow()
{
InitializeComponent();
Seed = new Random().Next(1,1000);
Loaded+=(s,e)=>GenerateWorld();
DataContext = this;
}
//....
}
public partial class MainWindow : Window
{
public static int Score { get; set; } = 10;
public static int Seed { get; set; }
double WorldHeight { get; set; }
double WorldWidth { get; set; }

public MainWindow()
{
InitializeComponent();
Seed = new Random().Next(1,1000);
Loaded+=(s,e)=>GenerateWorld();
DataContext = this;
}
//....
}
<Canvas x:Name="Display">
<Label x:Name="ScoreDisplay" Content="{Binding Path=Score}" Panel.ZIndex="10" Canvas.Top="0" Canvas.Left="960" FontSize="24" FontWeight="Bold"/>
</Canvas>
<Canvas x:Name="Display">
<Label x:Name="ScoreDisplay" Content="{Binding Path=Score}" Panel.ZIndex="10" Canvas.Top="0" Canvas.Left="960" FontSize="24" FontWeight="Bold"/>
</Canvas>
At the beggining the Label shows 10, but when i increment Score it doesn't update
46 replies
CC#
Created by Mąż Zuzanny Harmider Szczęście on 1/22/2025 in #help
✅ Issues with canvas
No description
4 replies
CC#
Created by Mąż Zuzanny Harmider Szczęście on 1/21/2025 in #help
✅ 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
7 replies
CC#
Created by Mąż Zuzanny Harmider Szczęście on 1/20/2025 in #help
✅ Listbox issue
hey, having issues with a listbox template:
<ListBox x:Name="PersonList" SelectionMode="Multiple">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Label Content="{Binding Name}"/>
<Label Content="{Binding Surname}"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<ListBox x:Name="PersonList" SelectionMode="Multiple">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Label Content="{Binding Name}"/>
<Label Content="{Binding Surname}"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
can you guys tell me what's wrong here?
public RemovePersonList(List<Person> personList)
{
InitializeComponent();
PersonList.ItemsSource = personList;
}
//How person class looks:
class Person{
public string Name;
public string Surname;
//...
}
public RemovePersonList(List<Person> personList)
{
InitializeComponent();
PersonList.ItemsSource = personList;
}
//How person class looks:
class Person{
public string Name;
public string Surname;
//...
}
The issue is that the items show up but they are empty
4 replies