Windows Presentation Foundation (WPF) is part of the Microsoft .NET framework used to create rich client user experiences for Windows application.
3
votes
0answers
26 views
Show dialog only once. Other calls should bring dialog to front, but otherwise not have a result
This code works, as far as I can tell, but there's something that just feels wrong about it. The intended flow is like this:
If no dialog is showing
Show dialog, return result
else
Move dialog ...
1
vote
1answer
45 views
Asynchronous method and collection binding
I have a WPF application, in which I'd like to bind a collection to a combobox using an asynchronous method :
...
5
votes
2answers
52 views
3
votes
1answer
38 views
Reducing repetition of sequence-like properties
I have a class that is a wrapper for memory positions of a hardware device.
I need to data-bind each of this positions, so I created a class with hardcoded properties, one for each position, so that ...
1
vote
1answer
33 views
Using a DependencyProperty ChangedCallback as a validation measure
I have an UserControl where I declare two DependencyProperties
...
5
votes
1answer
47 views
Go Back with More Detail
I have a Back function, and it is growing. I also think this is terrible, but I don't seem to get how it can be improved:
...
2
votes
2answers
66 views
Viewmodel has lots of properties which bind to view [closed]
I created a configuration View. so it binds a lot of properties in Viewmodel. But I have a another class People and I want to ...
2
votes
2answers
47 views
Finding the shortest path through a 2d space with a display
I decided to implement most of the reddit Daily Programmer space probe challenge. My program creates a 2D space that have asteroids and gravity wells distributed (the percentage of gravity wells and ...
2
votes
1answer
50 views
4
votes
1answer
88 views
From event handler to command: on my way to MVVM
I have a WPF C# application that I want to move to a MVVM pattern.
My first step is to remove the button click handlers from the code behind of the UI.
I've found some examples online and then ...
2
votes
1answer
36 views
Detecting the attachment of a DataContext
In our application the views and the viewmodels are created in parallel to increase the performance and when the viewmodel is created it is attached to the datacontext.
While there is no datacontext ...
5
votes
1answer
55 views
Handle Settings in Windows App
So, I fixed my problem with a public ViewModel for my MainPage like this:
MainPage.xaml.cs:
...
4
votes
2answers
80 views
Wiring CollectionView and grouping it without slowing it down
In my previous question, I got heaps of good advice BUT no solution for the problem apposed.
I applied the valuable learnings from the past on this.question and am also hitting it from a different ...
1
vote
1answer
64 views
Image cache for lots of images using WeakReference on C#
I'm developing an application to manage a player card-library from an online game. Each card has an image that is stored on disk with a numeric code, for example, the card with ID=1234 has his image ...
6
votes
2answers
103 views
Is my Delegate defined the right way and does it need to transform to a pretty Event butterfly?
I have read so many bed time stories and ins and outs of how delegates work and why events are to be replaced with delegates (surely not all the time) and just couldn't get my head around it.
I am ...
4
votes
2answers
77 views
MVVM, Navigation, and More - Part 3
This is actually a second follow-up to Correct MVVM format, but I have made different changes.
This is my ViewModel.cs class for my MainPage.xaml:
...
4
votes
1answer
85 views
Correct MVVM format
I have a Windows-Runtime app (very similar to WPF), and I am using (at least I think I am!) the MVVM style. I want to make sure I am doing this the proper way, and not just a working way.
This is my ...
4
votes
1answer
50 views
Reacting to Boolean state in reactive ViewModels
When this ViewModel loads we kick off the IsAuthenticatedCommand:
If the result of ...
5
votes
1answer
240 views
MahApps login dialog in splash screen with Caliburn Micro
We are working on an application with a splash screen. After a few seconds/loading all the data, a login dialog appears inside the splash screen, asking you to enter username and password. Think of a ...
2
votes
1answer
112 views
A ViewModel using ReactiveUI 6 that loads and sends data
Most of the Rx Compelling Examples™ load and store data locally which I don't find that Compelling.
I spent some time coming up with how to best perform the following actions but want to make sure I ...
8
votes
2answers
203 views
Wiring CollectionView and updating itself without the need for Refresh()
I have been using your expertise developing my application using parts of WPF that I have never touched before.
In this stage my View does all I need it to do, however, I am not sure if I've done my ...
6
votes
3answers
357 views
Best way of updating a list of unique items
I am wondering what the best practice for updating a list that only accepts unique items. Right now, I have a button that loads data from a database into a list. I can press this button numerous times ...
30
votes
2answers
2k views
Simon Says: “Make me a pretty game”
In Memoriam
Ralph H. Baer, co-inventor of the original "Simon" game, died Saturday December 6th 2014, at 92. With his passing, this friendly little challenge inadvertently became a memorial to ...
3
votes
2answers
45 views
Creating list ViewModels in the correct way
I'm using Caliburn Micro to create a WPF application.
So what I want to do here is a typical Master/Detail situation. I'm displaying a list of Users and you can can add/edit a User and save the ...
1
vote
1answer
192 views
Saving a collection of WPF user control layout into an XPS document
I am making an application to save a layout of user control into an .xps document. But, the export doesn't seem completed if the data is too many. I've tried to encapsulate each part with ...
4
votes
1answer
176 views
Checkbox binding to change the ListView's items source
I am using a checkbox to filter some components on my ListView by changing the variable's content which is bound to this ...
4
votes
1answer
155 views
Factory pattern with controls
I've created factory to create WPF controls. I have string with control name and I map it to enum. I think it's bad implementation of factory pattern. So please show me where I've made mistake.
Main ...
5
votes
1answer
140 views
Implementing ShowDialog() style functionality without disabling any other windows
I need a simple prompt window to ask the user to do something with an OK/Cancel return. But I also need all Windows to remain functional, so a xx.ShowDialog isn't appropriate.
This is my attempt. ...
6
votes
2answers
124 views
Is there a more efficient way of getting the max value from a list of sums?
Here is the code I have:
...
-2
votes
1answer
47 views
Suggestion for refactor wpf project
I have done a WPF project and hope everyone can give suggestion for code refactor, especially for
UpdateErrorList() method within the MainWindowViewModel.cs
...
12
votes
2answers
395 views
Understanding the MVVM concepts and validation of my code
I have been learning MVVM concepts and trying to implement it in my new project. I want to validate my work that I have been doing these past days. I want to know if I follow correctly the MVVM ...
2
votes
1answer
835 views
WPF ListView Pagination using MVVM Pattern
A few days ago, I was looking for simple pagination example and I decided to write my own version. It is one of my first apps using MVVM Pattern, so I am not sure I did right. I would appreciate if ...
6
votes
2answers
346 views
Noughts and Crosses WPF app
I've been learning C# and was looking for some feedback on my latest project, which is a standard Noughts and Crosses game. Two people are required to play (no AI yet).
MainWindow.xaml.cs
...
8
votes
2answers
461 views
Add or view pattern with MVVM
I have a model called WorkOrder which I want to be able to manage from a single window.
The required operations (for now) are only Insert and view, so this is what ...
2
votes
2answers
141 views
Custom TextBox control: AppendLine
Is there any way to improve this simple addition to the textbox control: appending a new line?
...
10
votes
7answers
2k views
How to simplify this if else statement?
How would you simplify/improve the readability of this code? Because even after my attempt to improve the readability I think it still looks messy.
...
1
vote
1answer
837 views
Access View from current/corresponding ViewModel
Sometimes when developing a WPF application, I need to access a certain Window (View) from the corresponding ...
3
votes
3answers
772 views
WPF Calculator Code
I've coded a calculator in C# with WPF as the UI.
I wish to know mainly about these points:
Ways of optimizing
Better techniques, tactics and ways of coding this
All flaws on the surface as well as ...
5
votes
2answers
442 views
Good practice for client code to MVC WebApi service
I have written a very simple web service with MVC and WebApi. Now I'm working on the client code which will be a WPF application (and soon Windows 8 Store/Phone app). What I have done works, but I'm ...
2
votes
1answer
153 views
ViewStateManager for more than just Controls?
Okay - so basically I have a login form that has a couple of 'states' it needs to display (connecting, input credentials, authenticating, invalid credentials, etc...etc...) - in the past I've ...
2
votes
1answer
150 views
Cross Thread Access to Object in ViewModel
This is a fairly straight forward question. I have a C# WPF MVVM application that call a C++ DLL to do some compilation/crunching. To update the UI C# application for progress updates I am using ...
2
votes
0answers
183 views
Possible memory leak with WPF Custom Control?
I might have a potential memory leak with my custom control. Do I actually have one?
...
8
votes
2answers
308 views
Am I handling “spot the missing DLL” right?
I have a .net 4.5 desktop script which has dependencies on some third party libraries (dll's). These libraries are used in my MainWindowViewModel. I need to check ...
5
votes
1answer
975 views
Adding groups to ListView depending on the data in a list
I have written simple code which loops through a list object and create groups in ListView depending on the data in the list. I have a list object of type ...
2
votes
1answer
156 views
Rewriting WPF GridViewColumn alignment in a less verbose way
I wanted just to right align one column in WPF and I found out that the syntax is not exactly syntetic... Is there a way to make it more syntetic?
Consider that this one colum, but I have 20 columns ...
4
votes
1answer
198 views
Insert Model object effectively using entity framwork
I have a WPF MVVM Application. I have a Customer Model which is generated by an entity framework (Database first approach) and one CustomerViewModel where I ...
5
votes
1answer
155 views
Justification of my current approach and possible suggestions about alternative to a Grid in a StackPanel form for an easier way of inserting new rows
In my real life example I am at a layout stage and before I actually move any further I would like to review my current approach. I am still learning about UI, XAML on WPF technology and I guess I ...
6
votes
1answer
74 views
Manage a collection of settings in memory with global scope
I have a WPF app and a bunch of read/write settings that need to be accessible from various view models. a setting can be any type (string, ...
2
votes
1answer
88 views
Optimizing playlist processing
I am trying to process an audio library file which is about 350 KB. My application processes each song on the file gets its meta-data and displays it in a List Box.
The problem is that it takes too ...
0
votes
1answer
76 views
Defining a DataTemplateBase
I have defined some DataTemplates are similar. The templates are like that:
...