Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I’m trying to learn some WPF tricks and I’m stuck on WPF-Dependency.
Can anybody explain what is it and it’s use. Any websites with the explanation of using it.
What is Dependency
Dependency means an object depending upon another object.
An object O1 depends upon another object O2 when O1 is using O2's property to do some changes in its own(O1) property.
Why we need it
To achieve these changes, some notification logic is needed of-course. Before WPF or similar technology, we were doing it using event handlers.
Now, with WPF and similar technologies, we tell the underlying framework to do this for us. We tell underlying framework what we want ( using some syntax ) without bothering how ? And underlying framework does this for us.
Provisions provided by WPF
Binding using code/xaml.
DependencyProperty
Triggers
INotifyPropertyChanged interface
Learn about these, and slowly you will get the hold of it.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I got this question in an interview.
Why Microsoft framework has asp.net life cycle events, instead of this, we can write everything in single event. Seriously I too dont know why Microsoft have so many events? and what is the advantage of it.
Could anyone help me to understand the benefits of distributing the process among the events?
The webforms were designed to mimic desktop applications, so that it was easier for desktop developers to enter the web world.
As a part of this, an control structure representing the page was needed, plus event handling (onclick handlers and such). To support this in the web world, the page lifecycle was introduced. This enabled developers to influence things at particular stages.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I know my question is subjective and context dependent, but being a beginner to MVVM, I came to know that generally one of the MVVM class is made singleton. Can anybody please tell me if I have Model, ViewModel and View class, generally people prefer which class as singleton and why is it so?
Technically, the Application class is really the only "required singleton" in a WPF application, and that's mainly because WPF will create it for you.
Otherwise, I typically avoid singletons in my WPF applications completely - there is no reason to introduce them.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
Assuming I was writing my own version of .Net :)
What would be the downside of such a setup?
Yes, I am talking about a new anti-pattern here to avoid creating endless tuples and EventArgs. I think such a setup would have made coding a lot cleaner.
No. The Tag property has history, it was important in VB6 and Winforms was meant to replace it. It needed to be added to make porting code relatively simple.
It is entirely unnecessary in .NET. It supports implementation inheritance, a feature that VB6 didn't have. So if you want to add extra properties then you just derive a class and add them. And you'll be able to give them a good name and a type so you don't have to cast every time you read the property. This works just as well with Winforms controls.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
So I'm having trobule figuring out the best way to use the MVVM pattern while creating a WPF control dynamically within
my code. Would this even make sense or is it better to avoid the MVVM pattern all together?
If it does make sense then please share code examples of the view model.
In general, if you're using MVVM, controls will only be created "dynamically" in response to the data changing. If you have an ItemsControl bound to a collection, for example, the controls to represent the items will automatically be created for you.
If you're talking about making a custom control in general, custom controls are really "pure view", so MVVM doens't really make sense in this scenario. The main goal of creating a custom control is to build it in a way so that it can be used by code developed with MVVM, which typically means building the control with proper Dependency Properties (so data binding works properly), etc.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I'm afraid my Google-Foo is failing me again today. I'm trying to find a good tutorial on creating custom ItemsControls in Silverlight (though I imgaine a WPF version might work as well).
I'm trying to create a custom ItemsControl that will be something of a virtualized ListBox. What I'm trying to accomplish isn't really similar enough to the current ListBox control to justify trying to modify the existing control, so I figure a custom one is in order here. I have a vague concept of how to accomplish it, but there are definite holes in my understanding.
Thanks in advance
See http://www.ladimolnar.com/Home/ViewArticle.aspx?ArticleName=HowToCustomizeAnItemsControl.
The article has a link to a sample app and sources. The sample app has a custom ItemsControl that also implements virtualization.