C
C#10mo ago
malkav

CommunityTools.Maui.Markup ColectionView

I'm trying to get a grip on the CommunityToolkit.Maui.Markup extensions, to create the MAUI application in C#, but I'm unsure how to bind my ItemSource to my labels. I've bound a mode to my ItemSource, but now in my Label() I'm trying to bind one of the properties of that model to that specific label. Here's what I've got so far: https://hastebin.com/share/rucosemalu.cpp In here you'll see my Children = { new Label().Text("ID: ").Row(Row.Id).Column(Column.Label), new Label().Text("id") ... This last Text("id") is where I'm trying to bind the Id property of my ItemSource (RespSubjectType) Basically what I've done is bind my ItemsSource to my ViewModel's SubjectTypes property. Which is RespSubjectType[] an array. And with my ItemTemplate I'm trying to get Maui to render the same template for each of the items in that array. Now for the Label.TextProperty value, I would like the Current item's Id, and Name properties set to their respective labels. I was hoping I could use BindContext to approach the SubjectTypes variable, but then I still don't have a way to approach the Id and Name values respectively. So if anyone could help me out to figure how I can (and probably should) set this up? Note: I am trying to create the MAUI app without xaml, hence the CommunityToolkit.Maui.Markup package Note_2: Even with hard-coded content, I still only are able to see my button, no singe CollectionItem. If anyone can share the issues with my code, or a solution to the problem at hand.
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server