Questions tagged [wpf]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
39 views

Inconsistent data between different viewmodels

Im building mainly WPF applications. I noticed a "problem" with inconsistent data. Usually I have a ViewModel, the VM has a load method, which gets data from the database, the user can edit ...
1
vote
1answer
33 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 ...
-1
votes
1answer
30 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# ...
2
votes
2answers
84 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 ...
1
vote
2answers
77 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 ...
0
votes
0answers
67 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 ...
-1
votes
1answer
50 views

What to do with a legacy code base with no unit tests and complex architectural structure [duplicate]

I have been working for my company for almost a year now and been primarily focused on adding features and maintaining two 15+-year-old WPF Projects and one 20+-year-old WinForms Project. The ...
0
votes
0answers
17 views

Multiple simultaneous users with oauth

I'm dealing with a native .net WPF app which is more or less a shopping client operated on one of multiple self service terminals. On these terminals the users have four possibilities in order to ...
3
votes
5answers
853 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 ...
0
votes
1answer
62 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 ...
0
votes
1answer
65 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 ...
-3
votes
3answers
336 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 ...
0
votes
1answer
69 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. ...
-1
votes
2answers
82 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 ...
2
votes
1answer
76 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 ...
0
votes
1answer
474 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 => ...
0
votes
2answers
751 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; ...
2
votes
4answers
575 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 ...
1
vote
0answers
83 views

How to make view models more DRY? [closed]

When looking at the WPF view model code samples on the web/books almost all of them show same approach for the bind-able properties that are used for the binding and input in the UI and that often ...
0
votes
1answer
144 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 (...
5
votes
3answers
588 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 { ...
0
votes
1answer
163 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 ...
0
votes
0answers
547 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 ...
0
votes
1answer
34 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 ...
0
votes
3answers
380 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 ...
0
votes
1answer
144 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; ...
4
votes
1answer
2k 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 (...
2
votes
1answer
108 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 ...
2
votes
1answer
2k 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 ...
5
votes
1answer
556 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 ...
0
votes
1answer
730 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 ...
1
vote
1answer
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 ...
2
votes
1answer
215 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 ...
-4
votes
2answers
829 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) {...
0
votes
1answer
634 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 ...
8
votes
4answers
7k 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 ...
3
votes
0answers
130 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 ...
9
votes
3answers
8k 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 ...
0
votes
0answers
438 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 ...
0
votes
0answers
306 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(...
-6
votes
2answers
167 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 ...
0
votes
1answer
115 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. ...
1
vote
2answers
797 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 ...
1
vote
1answer
2k 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. ...
1
vote
2answers
600 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 ...
3
votes
2answers
2k 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 ...
-2
votes
1answer
2k 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() { ......
0
votes
1answer
90 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 ...
4
votes
3answers
5k 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. ...
0
votes
2answers
4k 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 ...

1
2 3 4 5