Very nice tutorial, you had it right with the person object, you just set this.DataContext = this; and not to obj or obj.ToString() which resulted in setting the screen in to its on DataContext.
Thank you very much for your time to record the series of wonderful session. As a beginner, it has helped me a lot to understand the concept in a clear and systematically way. You explained in a crystal clear way. It would be more helpful for me if you can teach us how to insert, delete, fetch (All possible move with database) the data from database (SQL DB, using Entity Framework). I am trying to find but am not getting which can teach me clearly. Please record a session and upload it or if you have already recoded your sessions, then please share the direct URL.
Thanks a lot Sir for the wonderful tutorial! Have got a query in this video. In the constructor of the MainWindow class where the Data Context has been set as: "this.DataContext = this;" Everything works in this case. But if I set the Data Context as "this.DataContext = obj;", I do not see anything in the label after running the application. Could you please clarify what difference obj and this are making?
'Obj' is a property in the main window class of type person, so by setting datacontext as 'this' we can bind to the 'obj' property. If the datacontext is set to 'obj', which has a property Name, so you can only bind to 'Name' not 'obj' in xaml
Great Video , but i have a question, I inserted a Button inside the datatemplate with name : button_start. now i want to disabled this button in Code behind C# , but this buttonName does appear, please how i can solve it
I am creating a new person class in the project not in MainWindow.xaml.cs and then creating an instance of the person in MainWindow.Xaml.cs and initializing it there itself and then set the DataContext but I get nothing displayed on screen when I binded Label Content with object that I have created, you're at least getting the namespace.Pesron, kindly help I think I am missing some small basic concept.
Tough to tell, but make sure You are using correct obj name in binding. Before that u should build yr solution and then get the namesapace local (in our case dataTemplate demo,in yr case your proj name) Then play with datacontext. Hope it will work
If I use person obj in code-behind like this: Person aPerson = New Person(); aPerson.Name = "Virat Kholi"; This.DataContext = aPerson; and ... in xaml like this: // Nothing shows up. What is the problem here? Can you please explain?
Thank you for the tutorial. I think the example is not sufficient here. What if I do not want to represent a single piece of data, but a more complex, for example a concatanated string from FristName and LastName? How should I use Binding then?
I'm pretty new to this myself, so I could have completely misunderstood how Data Templates work. I think the example here is too simplistic to explain what you can do with a Data Template. As Shilpi points out, we can achieve the same result quite easily by just binding the Label to obj.Name. But what if we consider the previously defined Person class used in the "Data Context Property in WPF" tutorial? public class Person { public string FirstName {get; set; } public string LastName {get; set; } public int Age {get; set; } } and then define the Data Template as:
Why cant we use something like this and set DataContext = obj; as shown in previous example of DataContext Property.... This is working, but i am not able to understand why and when we have to use dataTemplates
What I like most about his training is slow and steady explanation.
This guy, I swear. Most helpful videos around.
Great video. Much better than Udemy courses. Thank you so much man. Thanks.
Very nice explanation 👌👍
This is the best video tutorial on WPF I have seen yet. Well done! Even better than the PluralSight course, with much more detail.
Jeremiah Seitz made my day... thanks
Great explanation
Thank you very much, i hope you to add more tutorials in .NET Envirement like create wpf mvvm c# project, for better understanding.
Excellent Work!
Excellent
Very nice tutorial, you had it right with the person object, you just set this.DataContext = this; and not to obj or obj.ToString() which resulted in setting the screen in to its on DataContext.
It's very nice
Hey, this is great, thank you! Do you mind making a video about the DataTemplateSelector?
this is great, THANKS
Thank you very much for your time to record the series of wonderful session. As a beginner, it has helped me a lot to understand the concept in a clear and systematically way. You explained in a crystal clear way. It would be more helpful for me if you can teach us how to insert, delete, fetch (All possible move with database) the data from database (SQL DB, using Entity Framework). I am trying to find but am not getting which can teach me clearly. Please record a session and upload it or if you have already recoded your sessions, then please share the direct URL.
Thanks a lot Sir for the wonderful tutorial!
Have got a query in this video.
In the constructor of the MainWindow class where the Data Context has been set as:
"this.DataContext = this;" Everything works in this case.
But if I set the Data Context as "this.DataContext = obj;", I do not see anything in the label after running the application.
Could you please clarify what difference obj and this are making?
'Obj' is a property in the main window class of type person, so by setting datacontext as 'this' we can bind to the 'obj' property.
If the datacontext is set to 'obj', which has a property Name, so you can only bind to 'Name' not 'obj' in xaml
Very well demo.. nice one, just want to know about What is ItemTemplate? Please let me know if we have lecture on that too.
Great Video , but i have a question, I inserted a Button inside the datatemplate with name : button_start.
now i want to disabled this button in Code behind C# , but this buttonName does appear, please how i can solve it
I am creating a new person class in the project not in MainWindow.xaml.cs and then creating an instance of the person in MainWindow.Xaml.cs and initializing it there itself and then set the DataContext but I get nothing displayed on screen when I binded Label Content with object that I have created, you're at least getting the namespace.Pesron, kindly help I think I am missing some small basic concept.
Tough to tell, but make sure You are using correct obj name in binding. Before that u should build yr solution and then get the namesapace local (in our case dataTemplate demo,in yr case your proj name)
Then play with datacontext. Hope it will work
If I use person obj in code-behind like this:
Person aPerson = New Person();
aPerson.Name = "Virat Kholi";
This.DataContext = aPerson;
and ... in xaml like this:
// Nothing shows up. What is the problem here? Can you please explain?
I have the same problem.
I'm a beginer but arn't u just set up the template of the label and never call it
You should to bind to aperson.name
Thank you for the tutorial. I think the example is not sufficient here. What if I do not want to represent a single piece of data, but a more complex, for example a concatanated string from FristName and LastName? How should I use Binding then?
Why should we use datatemplate when we can bind the property by obj.Name ?
Thank you for the great videos. I have a query, if I used the code as: , then also it worked fine without DataTemplates. plz explain.
@dotnetskool Exactly even i have the same question. Data Template use is not clear in this video. Can you please be more specific.
I'm pretty new to this myself, so I could have completely misunderstood how Data Templates work.
I think the example here is too simplistic to explain what you can do with a Data Template. As Shilpi points out, we can achieve the same result quite easily by just binding the Label to obj.Name. But what if we consider the previously defined Person class used in the "Data Context Property in WPF" tutorial?
public class Person
{
public string FirstName {get; set; }
public string LastName {get; set; }
public int Age {get; set; }
}
and then define the Data Template as:
Why cant we use something like this and set DataContext = obj; as shown in previous example of DataContext Property.... This is working, but i am not able to understand why and when we have to use dataTemplates