Questions tagged [wpf]

WPF is a graphical subsystem for rendering user interfaces in Windows-based applications.

Filter by
Sorted by
Tagged with
0 votes
1 answer
100 views

Clean code and SOLID principles in WPF/MVVM view models?

I'm currently reading "Clean Code" by Robert Martin (which I should have read years ago), and it's given me a bit of a wakeup call, especially regarding keeping methods and classes small, ...
user avatar
0 votes
0 answers
25 views

Custom templated controls, user control and MVVM approach

I am developing a data visualisation tool, with some UI interactivity after initial trail with doing it mostly by using templates in XAML and code behind to handle interactive stuff I've realised that ...
user avatar
-2 votes
0 answers
38 views

Updating Tab - Proper WPF MVVM [closed]

I've been struggling with the MVVM concept a lot. I am developing a remote file browser, so I can manage files on another computer from my own. I have a button that will open a new tab, so you can ...
user avatar
  • 99
-2 votes
1 answer
123 views

How Should I Go About Refactoring My Code With Dependency Injection? [closed]

I work on WPF applications used in testing hardware. I need to make my code base more testable and re-usable. I believe DI would help, but I'm not quite sure where to start. I've done my best with the ...
user avatar
0 votes
0 answers
36 views

WPF Best way to create viewmodel from another viewmodel

Often I want to open a new window from within some view. I see opening a window as view logic. So I don't want code in my viewmodel that creates/opens/changes windows or anything else that interacts ...
user avatar
1 vote
0 answers
55 views

Issue implementing the Command Processor pattern using MVVM for WPF?

I'm trying to implement the Command Processor pattern using MVVM for WPF. The Command Processor pattern that I'm roughly following is the one described in the book Pattern-Oriented Software ...
user avatar
  • 111
2 votes
1 answer
101 views

Data visualisation application for WPF and MVVM

I was wondering what is the best approach for a Data visualisation application for WPF and MVVM The key points are: The data is loaded, or needs just a little preparation such as pulling out ...
user avatar
2 votes
1 answer
55 views

How to set up MVVM for highly dependent hierarchical objects with 3D representation

Imagine a program that designs plates with geometric cutouts. You start with a rectangular plate. A plate can have one or more rectangular depressions carved out of it. Each of these can have one or ...
user avatar
  • 121
1 vote
2 answers
190 views

C# WPF - Is it acceptable to have a dependency to PresentationCore.dll in domain layer?

We are working on a .NET desktop application written in C# and WPF, that communicates with a REST API server. The software has a layered design and consists of multiple projects. One project for the ...
user avatar
3 votes
4 answers
454 views

C# How to avoid memory leak in this case

I've got a Window, which gets a viewmodel instance injected into its constructor. The window sets its DataContext to that viewmodel. The viewmodel contains a command to "submit" the window ...
user avatar
0 votes
0 answers
65 views

INotifyDataErrorInfo error propagation from child to parent objects

tl;dr I was wondering what is the best practice when having complex objects and using INotifyDataErrorInfo and every property can potentially have some validation implemented and a property can be a ...
user avatar
0 votes
1 answer
69 views

Does default deleting behavior of Datagrid violate mvvm pattern and separation of concerns

In WPF when Datagrid's CanUserDeleteRows property is set to true, then conveniently I don't need to implement deletion of elements from an underlying data structure. But it does mean that deletion ...
user avatar
-3 votes
1 answer
75 views

Inter application communication .Net

I have multiple WPF applications running different programs some of them are interconnected so one might have to start another at some stage. I need a way to communicate and share large amounts of ...
user avatar
1 vote
2 answers
182 views

Application made up of multiple executable programs

I am developing an engineering application (WPF, C#) that consists of a collection of other programs that perform specific engineering tasks. I guess you can think of it like Microsoft Office, however ...
user avatar
  • 21
-2 votes
1 answer
95 views

WPF MVVM using TPL - should I handle exceptions in the back or front end?

I have a WPF MVVM application, the WPF is the UI frontend and I have another project in the same solution that does DB access, I do this by starting a Task from the frontend that executes the backend ...
user avatar
1 vote
1 answer
309 views

DbContext lifetime in desktop app with SQLite

I am creating a small data-driven desktop application using .NET 5 with WPF, ReactiveUI, Dynamic Data, and EF Core 5. The app uses a local SQLite database to store all persisted state, and relies ...
user avatar
  • 292
0 votes
0 answers
62 views

Is it secure to make a seperate project which checks whether a license is active

I am trying to make a project which will help me to implement feature based licensing in future projects. The projects in this solution are C#/WPF Projects. So I have a Helper-Project with a class &...
user avatar
  • 101
1 vote
2 answers
70 views

How to edit and monitor changes in a complex Datamodel

I'm working on an Editor-GUI (C#, WPF, Windows-Desktop) for a quite complex domain model. The domain model consists of many different node types mainly coupled in a hierarchie. Also it is possible to ...
user avatar
1 vote
0 answers
59 views

Should all interactions go to ViewModel?

So basically I guess I know the role of MVVM, but correct me if I am wrong View: Basically it whats the users sees + it takes user interaction Also View: It shouldn't know what the model is ... but it ...
user avatar
1 vote
1 answer
217 views

Communication mechanism among windows or pages WPF

I work with C# and WPF and not using MVVM approach. One of the important part of applications is communication among Windows Pages and UserControls. In MVVM they do it behind the scenes and let you ...
user avatar
-1 votes
1 answer
533 views

MVVMCross multiple ViewModels and Views per Window

I may not being fully understanding MVVM or how MVVMCross works, but my understanding of views is that they are components of a window rather than the window itself. When you start up MVVMCross in C# ...
user avatar
  • 101
2 votes
2 answers
216 views

Is it right way to make Window to Singleton and call Visibility and Shutdown() methods directly in WPF?

There is a parent window that is the basis of the program, and there are several sub windows under it. Editor is one of the sub window and I'm making it. The code is as follows: // This is Code-Behind ...
user avatar
  • 61
1 vote
2 answers
595 views

What is the proper way to handle with View and ViewModel in WPF?

Currently, I'm making an Editor with MVVM pattern in WPF. Editor simply take an instance of a specific type as a reference and modifies it. The following code is the expected usage when editor ...
user avatar
  • 61
0 votes
0 answers
74 views

Is a lot of Wiring code a sign of over engineering or bad design?

We have a classic wpf line of business software at work. Put in a lot of data, save it, calculate some things, put out some useful data etc. Visually we have a dockable pane setup, like visual studio ...
user avatar
  • 89
6 votes
5 answers
7k views

WPF UserControl Reuse With MVVM

I'm struggling to find an elegant and idiomatic way of coding the following scenario using the MVVM paradigm in WPF and was wondering how other people would approach it. I have a UserControl in my ...
user avatar
0 votes
1 answer
166 views

CRUD actions rexponsibility in the MVVM

In Form-based application (WPF/MVVM/SQLServer), consider the form that handles the classical actions that you can perform on any entity. Create Read Update Delete The problem, in general terms, is ...
user avatar
  • 831
0 votes
1 answer
111 views

Structuring code to support console output and WPF views

Premise: This is for learning purpose. I'm trying to adapt my Console Application code to be served through a WPF Application GUI that I would like to create. One problem is struggling me. Actually ...
user avatar
  • 111
-3 votes
3 answers
806 views

Better way than singleton pattern to ensure single instance of class

When this question has been asked before on StackOverflow in 2011 and 2015, all answers as of now suggest to use a Singleton. But that’s not right. Singletons are defined by the Gang of Four to ...
user avatar
0 votes
1 answer
81 views

Best practice for populating a property of an entity object which requires a second database call

I'm running a commercial accounting software packages which uses a SQL server database. I've also developed a WPF application which is basically a slimmed down version of the commercial software. ...
user avatar
-1 votes
2 answers
86 views

Subscribing to events in factory -- better place?

I'm implementing an event-driven game in WPF and have the following Blackjack class: public class Blackjack { public Dealer Dealer { get; } = new Dealer(); public Player Player { get; } = new ...
user avatar
  • 1,149
2 votes
1 answer
83 views

Provide overall application status in global exception handler/crash report

In my UI application (WPF/C#, using MVVM design pattern), I have implemented a global exception handler which catches all unexpected (hence uncaught) exceptions and reports the application crash to ...
user avatar
1 vote
2 answers
1k views

Throttling notifications from child ViewModel to parent ViewModel

I have a child view-model which notifies on a property change: public class ChildViewModel : INotifyPropertyChanged { private bool isSelected; public bool IsSelected { get => ...
user avatar
  • 693
0 votes
2 answers
1k views

Is it okay to pass my model into my view model via its constructor through MVVM practices?

public class LDLTrackViewModel : RailwayViewModel { private LDLTrack _ldlTrack; public LDLTrack LDLTrack { get => _ldlTrack; set { _ldlTrack = value; ...
user avatar
2 votes
4 answers
992 views

Why does C# not have automatic dispatchers

Why does C# make you put in a dispatcher for a different thread to update the UI? Example: Dispatcher.Invoke(() = { lblerrorName.Content = ""; }); It always gives the 'running on different ...
user avatar
  • 81
0 votes
1 answer
258 views

Where do I save a Canvas "center position" coordinate in an MVVM architecture?

Assume I have a canvas that has rendered shapes. I can drag-move around that canvas as if I was in a zoomed in image to move all shapes around. Between the Model and ViewModel I have a ServiceLayer (...
user avatar
  • 393
6 votes
3 answers
1k views

How to avoid duplication of types in MVVM

I'm learning the MVVM pattern and something that comes up often is a duplication of data-types. Say I have a Person datatype. Intuitively I want it to look like this: public class Person { ...
user avatar
  • 191
0 votes
1 answer
272 views

Designing a WPF / MVVM architecture where view behavior changes in different states

As part of my bachelors thesis, I'm trying to develop something akin to a painting program. That means, I have a toolset, be it selection, drawing, highlighting, etc. I'll have a canvas that displays ...
user avatar
  • 393
0 votes
0 answers
912 views

.NET WPF Best way to store a connection credential

I have an application that connects to SQL Server using windows credentials, which works very well for the domain paradigm. The client is now transitioning away from having a domain server, and is ...
user avatar
0 votes
1 answer
36 views

Separate or not separate(Window and datagrid)?

I am new to WPF but actually I need to code in it. I have got a **UserControl(Window)** and there is a DataGrid in it. DataGrid can be used somewhere else in the future, but not 100% sure. Me and one ...
user avatar
  • 111
0 votes
3 answers
1k views

Keeping objects in RAM vs more queries to the database

So this is my DataStructure: Project - Name - ID - Image - History - User - Comment When my application first starts it is pulling all projects with all details. obviously ...
user avatar
  • 105
0 votes
1 answer
221 views

Unit testing for a method in a class which uses constructor DI (prism)

I have a class that uses constructor DI for IEventAggregator public SomeViewModel(IEventAggregator eventAggregator) { this.eventAggregator = eventAggregator; ...
user avatar
  • 433
7 votes
1 answer
4k views

Why can’t ViewModels communicate with each other?

Can someone explain concretely why it is not desirable for ViewModels to communicate directly with other view models? It seems to me that for virtually any UX application there will be a “root” view (...
user avatar
  • 71
2 votes
1 answer
112 views

How to propagate Setting Class throughout entire project [closed]

Here's my setup: Entity Framework Backend Large WPF project that has a main window with 3-4 user controls on it, each of which has 3-4 user controls on it (and so on, in some cases) What I currently ...
user avatar
  • 185
3 votes
1 answer
3k views

When to use The Messenger (Mediator) Pattern in MVVM design

I got confused with the role of the Messenger in MVVM. I see contradictory articles about it. This Article by MSDN by: Communicating from the View-Model to the View Observant readers will ...
user avatar
  • 171
5 votes
1 answer
758 views

Where is it better to implement Copy/Cut/Paste in MVVM?

I am working on a project using C#/WPF and following MVVM pattern. This project is designed for touch screens. The major objects of the program are the following: We have Programs which contain ...
user avatar
0 votes
1 answer
1k views

Giving Viewmodels access to application wide Model in MVVM

I am practicing building applications using MVVM and WPF+C# by making a "finance application". The application contains several views with their own ViewModels. The views are in a hierarchy and are ...
user avatar
  • 111
1 vote
1 answer
1k views

Wpf Application Structure? C#

I'm trying to port an application of mine from Java to C# and I can't for the life of me wrap my head around Wpf application structure. In Java my application runs the main() method which registers ...
user avatar
2 votes
1 answer
283 views

How to optimize a complex task with multiple DB calls

I have been working on a multi-layer, sale management application developed with WPF and partly refactored with EF6 (long story). The application has some very complex tasks which require multiple ...
user avatar
  • 21
-4 votes
2 answers
2k views

How to unit test this converter?

I am beginning with unit testing in c#. Here is my converter: public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { int c = 0; if (value != null) {...
user avatar
0 votes
1 answer
771 views

Dynamically injecting views with PRISM and WPF

I am writing application that will visualize some data. I will create custom user controls ( graphs,charts,tables ) for visualization. Now,to simplify it let's say, I want to have architecture like ...
user avatar
  • 115

1
2 3 4 5 6