michaellperry / updatecontrols Goto Github PK
View Code? Open in Web Editor NEWDependency tracking MVVM framework
License: MIT License
Dependency tracking MVVM framework
License: MIT License
This project has no license attached. Is this intentional?
Consider the following example model and view model:
public class ViewModel
{
private readonly Model model;
public ViewModel(Model model)
{
this.model = model;
}
public IEnumerable<string> Data => model.Data.Select(
x =>
{
Thread.Sleep(500);
return x;
});
}
public class Model
{
private readonly IndependentList<string> data = new IndependentList<string>();
public IEnumerable<string> Data => data;
public void Add(string s) => data.Add(s);
}
If you bind to the Data
property of the view model, and then you call model.Add
, this will cause ViewModel.Data
enumerable to be enumerated again.
INotifyCollectionChanged.CollectionChanged
is raised which is good. But I think that only this event should be raised and WPF shouldn't have to enumerate the collection again. If the list has a huge number of items this will be a performance issue.
In the example, I wait 0.5 second to simulate the cost of enumeration.
The expected behavior is that when you add a new item, you should wait 0.5 seconds. However, currently you wait 0.5 * the number of items in the list.
I suggest something like this in the ViewModel:
public IEnumerable<string> Data {get;} = new SomeDependentList(model.Data, x => { Thread.Sleep(500); return x;});
SomeDependentList
in this case wraps the independent list. When it receives the notification that an item was added, it transforms it via the function passed to it and then it sends a transformed notification to WPF.
Hi,
I used the Install-Package updatecontrols
to install for a winform project in VS2019.
However, pressing Ctrl-D
, Ctrl-G
does not bring up the tool to generate the codes.
Instead after Ctrl-G
, it simply asks which row I wish to skip to.
The MSI installer link is also broken https://updatecontrols.net/bin/UpdateControls.2.2.5.0.msi
Is this supposed to work for VS2019? If yes, is Install-Package updatecontrols
all that is required?
Thank you.
Are there plans to make this library support .NET Core 3.0?
Back when I used Update Controls, I loved it, with a couple of exceptions, both performance-related:
IndependentList<Foo>
and a DependentList<FooViewModel>
and you add a single item to the IndependentList, the entire DependentList is recomputed from scratch, as well as anything else that depends on it.Dependent<int> C
that computes the maximum value of two other precedents A and B, and then I decrease the smaller precedent A. In this case C does not change, but anything that depends on C is updated anyway. Not only are the dependents updated, but there is no way to suppress this behavior.Solving these problems is nontrivial, but I have outlined a solution to problem 2 here that appears like it would work. I wouldn't blame @michaellperry if the solution only goes into the replacement project Assisticant though.
I am building my first WPF application -- having come from a background in server development, so the MVVM pattern is new to me. So far I've been very happy with an MVVM framework I decided upon called Stylet.
I got to a point in my project where I have this dilemma that I need to maintain a list of objects that are displayed in the GUI. These objects represent program state and are also stored in a database so that whenever the user exits and relaunches the application, the app resumes from where user left off. As a result, I am storing information about the objects as well as their order that they appear in the UI.
The weirdness here is that the data is clearly reflective of the UI state itself, but I don't want to tie it directly to the WPF implementation. I decided to abstract it into a model, but then that became overly complex because I have to implement additional plumbing in the viewModel just to interact with the model. So that got me to start asking questions about what exactly a model really is and the nature of its data.
I read that you shouldn't put ObservableCollections directly in models, which stunned me because in this case I need to maintain data abstracted away from the UI for the sake of code reuse for other platform.
Because the data is itself directly representative of the UI, it doesn't make any sense to have this secondary layer of observable collection in the viewmodel and all the plumbing code to bind it to another collection in the model.
That's when I found out about UpdateControls and the concept of Independent and Dependent data. I read about it briefly and thought "wow. this makes a ton of sense. why haven't I heard about this before?" And then I look at the github. I see Michael has been maintaining the project actively, but the userbase is practically non-existant.
So as a developer new to MVVM on this first big desktop app project, I wonder if you can shine any light in the hole for me. Is there some reason why this library didn't take off when it was introduced many years ago? Do people just not understand the problem it solves? Is my particular problem an ideal example of where UpdateControls would shine?
Hope to hear from you. Thanks for taking the time to read this and consider! :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.