Skip to main content
13 votes
Accepted

Filter Collection by Multiple Criteria

You can build the LINQ query in several steps by appending new where clauses ...
Olivier Jacot-Descombes's user avatar
8 votes
Accepted

MVVM - ObservableCollection & Entity Framework DbContext

An EF DbContext is an IDisposable object that should be as short-lived as possible. There are a number of problems with this: <...
Mathieu Guindon's user avatar
8 votes
Accepted

Winform, with a workaround to avoid dependencies

If you start thinking with code, you will almost always end up doing bad things. Why? Because it is not natural. OK, no more preaching and let's get to work. Review of Your Code I apologize for ...
CodingYoshi's user avatar
7 votes
Accepted

WPF Mvvm async function ViewModel

General Your model should not return an ObservableCollection because that collection should be used only if its change notification ability is needed (e.g. with ...
JanDotNet's user avatar
  • 8,538
7 votes
Accepted

ViewModels Mediator with multiple generic callbacks

I don't feel like you should override + and -. Fine, it makes the syntax cuter, but it makes your code much less readable for ...
IEatBagels's user avatar
  • 12.4k
6 votes
Accepted

Data Model for a Memory Game

Design review or code review? Well, in real-world projects we communicate the design in its own way first, not just say “here’s code that implements my design.” I would like to see a paragraph ...
JDługosz's user avatar
  • 11.4k
6 votes

Scraping an parsing jockeys data using Task.Run

if (TaskCancellation == true) { break; } ...
Peter Taylor's user avatar
  • 24.1k
5 votes
Accepted

MVVM Navigation WPF

One of the basic principals of MVVM is, that the view model doesn't know the view. My experience is, that this principal can be (and should be) applied for the most cases. However, it is possible that ...
JanDotNet's user avatar
  • 8,538
5 votes

ViewModels Mediator with multiple generic callbacks

You should not be calling it a dictionary because you changed the expected behaviour of the IDictionary interface. The MSDN clearly states that the getter of the ...
t3chb0t's user avatar
  • 44.3k
5 votes

ViewModels Mediator with multiple generic callbacks

I fully agree with TopinFrassi and t3chb0t. Some other points The MultiDictionary and the AddableHashSet are not required and ...
JanDotNet's user avatar
  • 8,538
5 votes

ViewModels Mediator with multiple generic callbacks

Don't test whether a HashSet contains a key if you want to remove it: if(list.Contains(value)) { list.Remove(value); } ...
Deduplicator's user avatar
  • 19.3k
5 votes
Accepted

MVVM pattern in Xamarin login form

No, it's not correct. View-model shouldn't contain anything related to view. It means LoginViewModel shouldn't contain references on progress bar and label. ...
Maxim's user avatar
  • 2,542
5 votes
Accepted

Test all properties with single test function

too vague & hiding test cases ...
t3chb0t's user avatar
  • 44.3k
5 votes
Accepted

Visual Studio exception visualizer for lengthy exception messages

...
Peter Taylor's user avatar
  • 24.1k
5 votes

MVVM model letting the user select a directory in a testable manner

Review You always instantiate inner dialogs for both platforms, even though one will never be called. Your platform will not change at runtime. Use the Lazy pattern to only instantiate the required ...
dfhwze's user avatar
  • 13.9k
4 votes

AsyncCommand using MVVM and WPF

I realized that the question is quite old, but still seems to have some relevance. I guess people feel attracted, because they expect to find a usable asynchronous ...
BionicCode's user avatar
4 votes

Converting models into a list of ViewModels

I don't know what to say more then: make it an extension and return an IEnumerable<T> instead by using linq do you mean something like this? ...
t3chb0t's user avatar
  • 44.3k
4 votes

MP3 tag Project in MVVM style

Avoid using regions or use them only sparingly. Grouping fields or constructors doesn't make any sense and doesn't help anyone. Avoid the this keyword. It's rarely ...
t3chb0t's user avatar
  • 44.3k
4 votes

ListBox with a dynamic number of TextBox elements

There is not much to improve... additional to the points from Heslacher: a) That code: ...
JanDotNet's user avatar
  • 8,538
4 votes

ListBox with a dynamic number of TextBox elements

ExcludedPath If the value of the properties aren't changed you won't need to raise the PropertyChangedEvent so a simple check like ...
Heslacher's user avatar
  • 50.4k
4 votes

CommandBinding refresh on parameter changed

OK several years later and looking back I now know what I was doing wrong this is a misuse of the command parameter the command parameter is not a variable that you pass into the command on ...
MikeT's user avatar
  • 330
4 votes
Accepted

C# MVVM pattern sanity check

MVVM MVVM is normally structured as following: ...
Pieter Witvoet's user avatar
4 votes
Accepted

Testing async method call from constructor

Trying to load the data asynchronously in the constructor is a bad idea and in my opinion goes against what the constructor is for. Constructors cannot be async, and asynchronous initialization can ...
Nkosi's user avatar
  • 3,246
4 votes

Addition Program using wpf through MVVM

Some quick remarks: Give things proper names. "Model.cs" is a bad name for a class, and in your case it is even the name of a namespace. Microsoft has Naming Guidelines; please follow them. Same for ...
BCdotWEB's user avatar
  • 11.2k
4 votes
Accepted

MVVM model letting the user select a directory in a testable manner

Additionally to the great answer of dfhwze, I'll provide an alternative implementation that includes some of the suggestions. Primary, I would implement each case separatly and create / dispose the ...
JanDotNet's user avatar
  • 8,538
4 votes
Accepted

WPF MVVM ColorLister with navigation

Preface There is a lot to review. This review is focused on the parts that are not related to the View or ViewModel. Note: You have also edited the question concurrently with me making this review ...
dfhwze's user avatar
  • 13.9k
3 votes
Accepted

CommandBinding refresh on parameter changed

I'm having to break MVVM by having the view tell the VM command that its execution has changed because the command binding doesn't seem to refresh on the parameter changing. The fundamental problem ...
Peter Taylor's user avatar
  • 24.1k
3 votes

Transitioning a NavigationPane to use MVVM

Sometimes I feel like some of the SO answers are people looking at the UWP code and thinking it's WPF and put in their two cents without thinking... And yet there are only two lines related directly ...
t3chb0t's user avatar
  • 44.3k
3 votes
Accepted

Catching exception inside model

There is nothing inherently wrong with catching exceptions in viewmodel. The rule of the thumb is that you catch exceptions at level where you can handle them. Sometimes this level is viewmodel level. ...
Nikita B's user avatar
  • 13k
3 votes
Accepted

Invoke model logic in one UserControl from view-model in another UserControl without violating MVVM

You do not pass this value through views. There is no reason to make your views responsible for creating view models. For example this: ...
Nikita B's user avatar
  • 13k

Only top scored, non community-wiki answers of a minimum length are eligible