As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [wpf]

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

Filter by
Sorted by
Tagged with
1 vote
1 answer
2k 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 ...
CosmicKidd's user avatar
2 votes
1 answer
335 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 ...
Marco's 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) {...
shubham sharma's user avatar
0 votes
1 answer
841 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 ...
karollo's user avatar
  • 115
11 votes
5 answers
13k views

Moving from Qt/C++ to C#/WPF - Productivity Gain?

I created a small Desktop application (approx 15000 lines of code, so not that large) written in C++/Qt. This is non-commerical, just a hobby project and I am coding on my free time. The larger the ...
ndbd's user avatar
  • 349
3 votes
0 answers
178 views

Should I build a custom text editor from scratch or enhance existing ones?

I'm developing a Windows WPF app that needs to edit a certain type of document and I need a highly customized editor to do so: The text is a transcription of an audio feed, and I need to sync the the ...
Joshua Frank's user avatar
11 votes
3 answers
10k views

Is it good practice to use user controls to structure WPF forms even if these user controls are only used once?

I develop a WPF application using MVVM and I am learning how to do things best. I have a WPF form with selectors, two list with search fields, and some other elements. Currently all is in one form ...
Edgar's user avatar
  • 293
0 votes
0 answers
572 views

WPF DI with DbContext per form

Trying to figure out how to keep class methods clean, follow EF's guidance of short-lived DbContexts, and use DI in WPF. Issue I'm having is implementing transactions with DI. I'm trying to figure ...
keelerjr12's user avatar
  • 1,189
0 votes
0 answers
415 views

Should I populate view model inside or before creating it

I'm not sure if softwareengineering exchange is right for the question. I need to populate view model with some values I query from the database. I do it like: var db = new NPoco.Database(...
Konrad's user avatar
  • 1,499
-6 votes
2 answers
226 views

It's safe to access to the database and querying from it directly if it's on the server side, if not what should i do? [closed]

I made WPF application for a client-side and hosting database in a server side , I know there is something called REST API to transfer data between a client and server I don't know this method and ...
Ali Waleed's user avatar
0 votes
1 answer
150 views

Architecture for distributed real time traffic capturing/viewer system

I have a scenario as following (you can think of it as a distributed Wireshark system): For a single capturing session, there are about 1 ~ 10 traffic capturing nodes distributed in a LAN network. ...
ricky's user avatar
  • 109
1 vote
2 answers
1k views

MVVM. Is it a code smell when view model has properties with names show/hide/display that semantically belong to view?

I've lately been involved with WPF and looked into MVVM. I understand that view model shouldn't be aware of view. However, sometimes I come across situation where my initial instinct is to write ...
Siim Haas's user avatar
  • 151
1 vote
1 answer
3k views

WPF, Dialog Service as injectable Service or a Static class

The background In MVVM, we tend "not" want to couple windows to view models for various reasons. Though from the very second screen on your application you start hitting this conceptual grey zone. ...
user avatar
1 vote
2 answers
1k views

Dealing with stale data persistence

Currently implemented the model and working on the UI for a scheduling application. This is just an in-house application for work between ~5 people that may occasionally have the application running ...
keelerjr12's user avatar
  • 1,189
3 votes
2 answers
3k views

Adding model into another view model's collection

The Setup So I'm working on a project in which there exists a MainViewModel class. This MainViewModel contains a list of Soldiers through an observable collection. I have a button in the MainView ...
Matthew S's user avatar
  • 143
-2 votes
1 answer
3k views

Check is finish async and await behavior

I am trying to understand the async and await.Now i want to apply async and await keyword in my current project.My process structure are: //DataAccess Private List<Users> GetAllUsers() { ......
Loran's user avatar
  • 101
0 votes
1 answer
172 views

Database checking for updates

Using SQLite in a WPF application that schedules events for people. The application will be used by 2-4 users concurrently. I'm wondering how to ensure each user has the most current database ...
keelerjr12's user avatar
  • 1,189
6 votes
3 answers
7k views

Is implementing INotifyPropertyChanged on a custom control a bad practice?

Imagine a Control is being created. It has some DependencyProperties and there are some properties which depend on the DependencyProperties, but doesn't need to be seen or updated from the outside. ...
appa yip yip's user avatar
0 votes
2 answers
6k views

Overall view validation with a datagrid and keeping to MVVM

I am struggling to find a good architecture for what must be a common problem Enable/Disable a button in a View that contains a datagrid, and has validation requirements on the cell, row and ...
Peter M's user avatar
  • 2,029
3 votes
1 answer
11k views

WPF MVVM Loading data on startup

I am building a simple master-details GUI using WPF/MVVM/Prism for some data coming from a Restful service. I have the main window as my main view with a corresponding view model. I have a user ...
Bishoy's user avatar
  • 181
1 vote
2 answers
6k views

How to implement validation before setting a property value in MVVM (WPF)

Scenario. ViewModel has a property State. View has a ComboBox that allows to change value of State. ViewModel needs to run some validation (call bool ValidateState(State value) method) before setting ...
Pavels Ahmadulins's user avatar
4 votes
3 answers
13k views

MVVM Correct way to switch between views occupying the same footprint on the screen

An example is switching the main view according to the selected item in a hamburger menu. Also sometimes it is just a small part of the GUI that changes according to the application state or according ...
Bishoy's user avatar
  • 181
1 vote
1 answer
379 views

how should the MVP pattern handle views created at runtime?

how should the MVP pattern handle views created at runtime ? for example There is a mainView (that has a model and presenter) that needs to display a list, each item in the list is represented by it'...
user1450877's user avatar
  • 1,052
20 votes
4 answers
33k views

Is it OK to create an Entity Framework DataContext object and dispose it in a using block in each of my CRUD methods?

I'm building a wpf application which implements the following features: Take user input and read data from databases perform some calculations on it Showcase it to the user in multiple types of views ...
Skyuppercut's user avatar
1 vote
1 answer
2k views

Duplicating Domain Model in View Model or not

I have an XML file that contains configuration information for a system. I can serialize/deserialize the XML into a hierarchy of objects that describe the configuration (and no more) and then pass ...
Peter M's user avatar
  • 2,029
5 votes
2 answers
14k views

How to separate the ViewModel from the Model, yet associate them with each other based on the Model?

In a wpf application, a Model object is created either from scratch or deserialized from some .xml file. To create a connection to the ViewModel, the following method (on the Model!) is used by the ...
surface's user avatar
  • 109
-1 votes
1 answer
487 views

How to integrate WPF and AKKA

I'm new to AKKA and i can't figure out a general proper way to integrate a backend actor system with my WPF views. I studied a few examples i found (all very similar, probably based on this), but in ...
Mauro Sampietro's user avatar
0 votes
2 answers
1k views

Can data model have Business logic reference?

This is a WPF application using MVVM design that connects to Services (Business logic layer) which manage Models, with an exception that some property set of the model is bound to some views directly. ...
KDR's user avatar
  • 153
-1 votes
2 answers
151 views

Outsourcing reporting service for multiple customers [duplicate]

I want to develop a robust system written in C# (WPF and WCF) for importing .csv files (and/or some others e.g. Word files) as a input into my system and then to generate PDF/Word report. I would ...
Stefan0309's user avatar
2 votes
2 answers
1k views

WPF/C#: What is the accepted way for a lower level object to notify the UI?

Setting Let's take the following example: We have a series of entertaining events on the television with each lasting only an hour and this goes on for 3 weeks. We want to create a simple App that ...
oneManArmin's user avatar
3 votes
1 answer
2k views

MVVM communicate between views

I know we can use the Mediator Pattern to communicate between view models but what about views? Lets assume I have a button in View A which should trigger functionality of View B. How is this ...
Asperger's user avatar
  • 213
1 vote
1 answer
464 views

WPF – Arrangable row of rectangles

I originally posted this on StackOverflow, but got the message that this was the correct forum for such a question. https://stackoverflow.com/questions/44077183/wpf-arrangable-row-of-rectangles. I am ...
Pelle's user avatar
  • 113
0 votes
4 answers
1k views

Disable or Enable feature in C# application

I was asked this question in interview, but could not find answer anywhere: Lets say a application has feature which will unlock to different feature to diff customer lets say addition, deletion, ...
murmansk's user avatar
  • 119
1 vote
2 answers
4k views

WPF application architecture

I have written a WPF app which is now starting to suffer. There is no real way of adding new features to it in it's current state, it has become sluggish to use. This application started as a demo ...
DrLazer's user avatar
  • 143
3 votes
1 answer
1k views

Mutually dependent Properties in WPF

I have a WPF view which contains 2 mutually dependent properties; a change in one might trigger a change in the other. How do I write code that cleanly updates both? More specifically: I have WPF ...
Ramzi Kahil's user avatar
  • 1,089
-1 votes
1 answer
5k views

Can MVVM architecture be used in designing web applications?

One of the client for whom I had worked has a MVVM architecture for web application.I dont know why they incorporated instead of MVC. is this a feasible idea because as far as I have gone through all ...
Hameed Syed's user avatar
1 vote
2 answers
4k views

Preserve MVVM while using XAML resources

Context: I'm creating a WPF application using MVVM. I have a Page which displays a status informing what task the app is performing on Background. I have a container, and bind its Content to an ...
appa yip yip's user avatar
1 vote
1 answer
1k views

MVVM, is it better suited for web applications or GUIs?

I am currently deciding whether I should implement a new system with a web application as a front-end, or if I should instead produce an executable file using WPF. The pattern that I will use is MVVM,...
Iliana's user avatar
  • 81
0 votes
1 answer
3k views

Is MVVM the right choice for a single-developer WPF project?

I'm starting to design and develop a WPF application for my company and one of the first choices that I have to make is whether or not to use MVVM. The main points to consider are: The application ...
Brutus's user avatar
  • 131
4 votes
1 answer
209 views

Design decision to memorize already constructed instances/references

I am working in WPF application and in need of a best design decision for one scenario. Basically, I am reading a .net assembly to extract the types and properties and mapping it to my own created ...
Furqan Safdar's user avatar
1 vote
0 answers
564 views

Opening new Window from ViewModel using Castle Windsor

I've been following the quick tutorial on using Castle Windsor in MVVM WPF: TUTORIAL I've set everything up (as for the basics) but I came to the point of creating a new Window after a button click. ...
Kamil Solecki's user avatar
2 votes
1 answer
5k views

When using MVVM, is it okay to use property injection on a view model in WPF?

I am rather new to the concept of MVVM in C#/.NET WPF projects. The way I understand it, the view-model is supposed to lessen the amount of code-behind required to display data on a form. I try to do ...
Snoop's user avatar
  • 2,718
5 votes
2 answers
423 views

Should I create a (new) project for shared UserControls?

Context: I'm creating some applications to help me on my daily tasks, it does not connect anywhere and the only "data" it has to deal with is the parameters that I enter on the input fields. This is ...
appa yip yip's user avatar
3 votes
1 answer
1k views

MVVM Inheritance following SOLID principles

I'm currently at the design phase of my program (hence no code). It will be written in WPF in C# using MVVM principles. I'm going to have a multifunctional Drag & Drop control, that will act ...
Kamil Solecki's user avatar
0 votes
1 answer
179 views

Should I worry about UI in my domain? Domain Driven Design

So I've been learning DDD and am attempting to refactor an old project using this approach. It is a fairly small app to register employees for events. These employees are initially populated from the ...
MickB's user avatar
  • 101
0 votes
2 answers
229 views

What architecture/guidelines should be considered to write reusable module of project?

Introduction I am working on MyProject which is windows (desktop) application being developed in C#.NET and DotNet Framework 4 in WPF. Project is layered as DataAccessLayer (DAL) --> ...
Amit Joshi's user avatar
5 votes
1 answer
4k views

MVVM best practices with WPF client and WCF duplex service

I've been thinking about how to design my WPF application, which receives data from a WCF duplex service, but I'm afraid of over engineering. I thought about abstracting away the WCF communication ...
Shahin Dohan's user avatar
3 votes
2 answers
2k views

State handling in WPF-MVVM

I am looking for advice on handling states in a WPF MVVM environment. As an example, assume we have A TreeView (or some other ItemsControl) with some items and a button that is enabled when an item ...
Kjara's user avatar
  • 272
2 votes
3 answers
8k views

In-memory data collection object(s) vs database

I have a couple of questions about the practicality of developing a WPF application that loads data into memory from a text file and then manipulates the resulting object(s) instead of transactions ...
LNX's user avatar
  • 129
0 votes
1 answer
1k views

remote interaction with WPF C# desktop application

I have created a standalone application with WPF and I need to use some of its functions via web. In few words, I would like that an user can access a web page and have the chance to insert some data ...
FrancescoDS's user avatar