Thanks a lot for this. Exactly what I needed! Been struggling with this problem for a while!
@jfversluis3 жыл бұрын
Awesome! Glad I could help you out!
@joehanna_ Жыл бұрын
Thanks for another great video - you are doing an awesome job here for the Xamarin platform. For future videos, please choose names a little more carefully. I understand you said that the DataTemplate x:Key didn't have to match anything else, but it does in fact match properties used in the SubscribeDataTemplateSelector class. Coming in new to this and trying to review the code and glue it all together, this becomes confusing very quickly. Still worthy of ⭐⭐⭐⭐⭐Thank you so much!
@boysen013 жыл бұрын
Thanks for sharing Gerald, this is great. Any chance you know what the C# equivalent statements to the XAML at 12:00 would look like?
@jfversluis3 жыл бұрын
Absolutely! Described in our wonderful Docs: docs.microsoft.com/xamarin/xamarin-forms/app-fundamentals/templates/data-templates/selector#consuming-a-datatemplateselector-in-c
@boysen013 жыл бұрын
@@jfversluis Very nice example, thanks! It is great that most of these examples show the C# equivalent code
@jfversluis3 жыл бұрын
@@boysen01 the docs are pretty good that way!
@_samirdahal4 жыл бұрын
I will call that, Conditional rendering 😎. Thank you for sharing Gerlad! 🎉
@jfversluis4 жыл бұрын
Haha yeah that’s a good name! Glad you liked it!
@СергейКошельник-н9н2 жыл бұрын
Great job!
@jfversluis2 жыл бұрын
Thank you!
@AMIRKHAN-dm2fm4 жыл бұрын
i have a question . i am using collection view in one of my project.in collection view i am using lable and using x:Name=lblName property but this lblName .. i cant access in my .cs file why?and the other side any other lable outside the collection view i can access. Thanks
@jfversluis4 жыл бұрын
I'm assuming you are using that inside of a DataTemplate?
@AMIRKHAN-dm2fm4 жыл бұрын
@@jfversluis yes sir . is there any solution to achieve that.
@wmernissi28302 жыл бұрын
Helo Gerald. I am using .NET MAUI. I am trying to set the data template of a collection view in a custom control through the usage of a bindable property in the custom control. The bindable property of the custom control is set from the MainPage using XAML code and it contains a ContentView with a Grid which, in turn, has labels. When I set the item template of the collection view inside the custom control when the there is a property change, the collection view will not work. Any ideas ?
@EdRawrDev58132 жыл бұрын
Hi I got a Specified cast is not valid. following the tutorial any idea? I tried same steps.
@jfversluis2 жыл бұрын
Did you pull down the sample code from the repo and try that?
@Ajaxbreaker4 жыл бұрын
Awesome! I just spent two days banging my head against a wall trying to figure out why my data binding wasn't working and literally an hour after figuring it out I saw this video which is probably the clearest demo I've seen of it and you weren't even covering the subject :D. Real question though: this works if you're just pulling info from a list of strings but it'd be really helpful to see an example of a more complex object. If I'm passing it an object with a name string property for instance and I try to access item.name my application starts throwing errors...
@jfversluis4 жыл бұрын
Haha awesome! Well, I wish you’d seen the video before, but appreciate you letting me know and the kind words! Noted on the complex object. Let’s see if I can whip up a video about that... what are the errors you’re seeing?
@michaelfelleisen64243 жыл бұрын
Frist you have to tell your DataTemplate from which class you want to bind properties. For me it was a class in my "Models" folder so I added an include for my like this: xmlns:models="clr-namespace:[YourProjectName].Models" and after that you can tell your which DataType to use like this: now you could bind something from your class inside the
@TBTH2H2 жыл бұрын
Hi Gerald, thanks a lot for this great video, which is really helpful! I assume, the same approach can be used in .Net Maui, correct? And I have another question: How can I extend that for handle selected items also? Do I have to extend the logic for a third entry? What I want to do is to use alternating row-styles in a kind of datagrid-control. Best regards: Thomas
@alexanderspiegel67473 жыл бұрын
The video and background color are nice :-)
@jfversluis3 жыл бұрын
Thanks Alexander! 😃
@yeahscienceman3 жыл бұрын
How can i set data template in accordance with CarrouselView.Position? Like if it is 0 - OneTemplate, 1 - SecondTemplate... P.S: i did make a reference to the CarouselView in the selector class, but it does not change the position value from 0
@jfversluis3 жыл бұрын
Hm is there another way to do that? Technically you could determine in what position the item is, but not sure if that is something you would want to do
@yeahscienceman3 жыл бұрын
@@jfversluis managed to succeed it by using ControlTemplate
@aiyaar35884 жыл бұрын
Lol, how do you read my mind, Another great! video from you Gerald, I wish I could have 1000 accounts on KZbin and you will get subscription from all of them! :) Awesome!
@jfversluis4 жыл бұрын
Maybe someone gave me a little hint to make this... thank you Omar!
@alikarimi014 жыл бұрын
If it is possible for you , please create a video for binding
@jfversluis4 жыл бұрын
What do you want to learn about binding?
@alikarimi014 жыл бұрын
@@jfversluis I have a data grid with 5 columns , in the columns there are some numbers are negative. I want to set their number and textColor with binding
@jfversluis3 жыл бұрын
Here are a couple of videos on data binding: kzbin.info/aero/PLfbOp004UaYWOuVUuEtGlpkDIC1houhn_ Does that help? :)
@jfversluis3 жыл бұрын
@@codigoadictivo let me know what is unclear after that
@davidmorrow13932 жыл бұрын
How do you access Label's or Entry's from DataTemplateSelector? Like access Label on SubscribeTemplate? tried x:Name="SelectorLabel" with no Intellisense.
@jfversluis2 жыл бұрын
Since it’s a template that will be applied to each entry it’s impossible to work with x:Name. Each instance would have the exact same name. You will have to use data-binding. Have a look here: kzbin.info/aero/PLfbOp004UaYWOuVUuEtGlpkDIC1houhn_