✅ Help with wpf binding issues

Hey guys, im having issues with wpf binding again... would be nice to get some help: code
GitHub
GitHub - JuanNotTheHuman/TileGame
Contribute to JuanNotTheHuman/TileGame development by creating an account on GitHub.
25 Replies
Sehra
Sehra2d ago
$details
MODiX
MODiX2d ago
When you ask a question, make sure you include as much detail as possible. Such as code, the issue you are facing, what you expect the result to be, what .NET version you are using and what platform/environment (if any) are relevant to your question. Upload code here https://paste.mod.gg/, save, and copy the link into chat for others to see your shared code! (see $code for more information on how to paste your code)
Mąż Zuzanny Harmider Szczęście
the issue is inside Views/GameCreationView.xaml lines 220-247 i just don't have any idea on how to make the binding work.
Insire
Insire2d ago
whats the actual goal here. you set the datacontext on that control, just so you can ignore it in your binding
Mąż Zuzanny Harmider Szczęście
its from a previous attempt, the goal is to display and edit the amount of drops from click
No description
Insire
Insire2d ago
ok, so whats the issue here? you seem to know how to bind things
Mąż Zuzanny Harmider Szczęście
the issue is that i dont know how to bind this thing
Insire
Insire2d ago
what thing
Mąż Zuzanny Harmider Szczęście
the count and ModifyDropCommand
Insire
Insire2d ago
so you are saying the binding in line 220 is how its supposed to be and you are only worried about the binding in the DataTemplate? because from my POV that binding is garbage
Mąż Zuzanny Harmider Szczęście
not sure anymore... <ItemsControl ItemsSource="{Binding Source={StaticResource ItemTypeValues}}"> is to get all item types and then for each itemType get the amount from foreground generation not sure if im doing it right
Insire
Insire2d ago
does it work?
Insire
Insire2d ago
then no
Mąż Zuzanny Harmider Szczęście
whats the correct way to do it then
Insire
Insire2d ago
i recommend taking a step back and design something thats bindable and im not going to answer that you clearly want a collection there, although not sure if you actually want one
Mąż Zuzanny Harmider Szczęście
by there u mean?
Insire
Insire2d ago
depends on how many "drops" there are and if that amount is going to change im still talking about line 220
Mąż Zuzanny Harmider Szczęście
i want to be able to add a drop when i want to ig wouldn't it be better to add all possible drops and set them to 0 and just read that? it would make the itemssource work better, right? no need for wierd binding structure then ig?
Insire
Insire2d ago
no, that doesnt matter if you bind a bindable collection, then the contents dont matter or when you decide to add them anyway, so it seems you want a collection so go add a bindable collection to the viewmodel, then write another viewmodel that goes inside there
Mąż Zuzanny Harmider Szczęście
i want the game to be configurable so yeah ???
Insire
Insire2d ago
go use your words im not interested in pulling them out of your head. either you work with me, or you dont (which is fine) and i go do something else
Mąż Zuzanny Harmider Szczęście
im just really tired and confused need a sec
Insire
Insire2d ago
then there is no point to this right now anyway go come back when you are not tired
Mąż Zuzanny Harmider Szczęście
ok, figured it out, made some junky code, but it works

Did you find this page helpful?