Windows Presentation Foundation (WPF) is part of the Microsoft .NET framework used to create rich client user experiences for Windows application.
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 ...
13
votes
5answers
9k views
MVVM, WPF Ribbon V4, with Prism
This weekend I've been having one heck of a time getting WPF Ribbon v4 working with MVVM and Prism (using unity). After much trial and error, I believe I have it working. I was hoping someone could ...
12
votes
2answers
476 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 ...
12
votes
1answer
7k views
Single-instance WPF application
This is the code I implemented so far to create a single instance WPF application:
...
11
votes
1answer
397 views
Does my code conform to modern conventions?
I've spent a few days making the transition from WinForms to WPF, and do not have much time for tutorials as the work needs to be done quickly. I was wondering if anyone could take a look at a sample ...
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.
...
10
votes
1answer
2k views
Is there a better way to get a child?
I have written the following code to get ImageColorPicker child:
...
10
votes
1answer
446 views
Lots of Storyboards in XAML, huge file
After spending a few ages writing out every combination of triggers, bindings and storyboards, I finally managed to get my program working. First time working with WPF, so I made a big mess. Now it's ...
10
votes
1answer
169 views
TicTactics Presentation
This is my take at the current code-challenge, Ultimate Tic-Tac-Toe, at least the presentation part.
As I chose to write a WPF application for my game, and this is my very first time fiddling with a ...
8
votes
2answers
536 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 ...
8
votes
2answers
262 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 ...
8
votes
2answers
315 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 ...
8
votes
2answers
4k views
Is nesting grids a good idea?
I find myself nesting a lot of grids inside grids in WPF.
I just found myself 3 Grids deep, and stopped to think: "Should I be doing this?"
Is there some kind of performance cost?
Is it ...
7
votes
2answers
2k views
Animating the color of a line in WPF
I'm thinking about how to do a color transition for a line in WPF. I'm looking for this to be as simple and succinct as possible, and also the "correct" way in the WPF world.
This is what I have, ...
7
votes
2answers
4k views
Pong game in WPF
This is my first post here and one of my first WPF projects. The game works, but I would like to get some advice regarding what could be done better/differently.
I would especially like to find out ...
6
votes
3answers
408 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 ...
6
votes
2answers
414 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
...
6
votes
1answer
9k views
Sort ObservableCollection after added new item
For a WPF application, I have to sort the items in ObservableCollection after Added new item.
...
6
votes
2answers
109 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 ...
6
votes
2answers
130 views
Is there a more efficient way of getting the max value from a list of sums?
Here is the code I have:
...
6
votes
1answer
80 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, ...
5
votes
2answers
552 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 ...
5
votes
1answer
159 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 ...
5
votes
2answers
57 views
5
votes
2answers
2k views
Simple clock view model
I have been trying to wrap my head around MVVM for the last week or more and still struggling a bit. I have watched Jason Dolingers MVVM video and gone through Reed Copsey lessons and still find ...
5
votes
1answer
59 views
Handle Settings in Windows App
So, I fixed my problem with a public ViewModel for my MainPage like this:
MainPage.xaml.cs:
...
5
votes
2answers
1k views
Filtered WPF textbox
I am trying to make a textbox which filters user input to match specified type, so I can discard some of my validation logic.
For example, if I specify ushort I ...
5
votes
1answer
487 views
Can this reactive code be improved?
I have a view model that I'm migrating to RxUI. It exposes a collection of brokers along with a bool indicating whether there is a market (ie. at least one broker). ...
5
votes
1answer
64 views
Managing Contact Collections
I have a WPF/MVVM form that contains sections for managing Recipient Contacts, CC Contacts and BCC Contacts.
Each of the three sections has buttons/ICommands for 'Add', 'Clear', 'Previous' and 'Next' ...
5
votes
1answer
779 views
View Model Base
I needed to write code in WPF for a client. The application is done with prism (not my decision, they already had people working on it), so I got a sparkling clean new module to work in. Since this ...
5
votes
1answer
49 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:
...
5
votes
1answer
168 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. ...
5
votes
1answer
1k 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 ...
5
votes
2answers
4k views
WPF Window with different DataTemplates
I have to do a task hard for me and maybe you can help me. I've tried to design a window dialog to update data from a database view. This database view contains integer, DateTime, string, Time, ...
5
votes
1answer
717 views
Trying to un-hack this DataTemplateSelector
I'm trying to emulate the default behavior of an ItemsControl in a ContentControl--Bind Content to an object property and use the correct DataTemplate based on that ...
5
votes
1answer
404 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 ...
4
votes
3answers
189 views
Better method for my property Checking, replacement of switch statement
I'm hoping this is the correct place for this, I'm struggling a little for wording as i'm not sure what you would call this.
Basically, i have a system in place where my datagrid marks cells that ...
4
votes
2answers
81 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
164 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 ...
4
votes
2answers
108 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 ...
4
votes
1answer
289 views
Refactor code for usability
I need help to refactor my code. I usually had a hard time figuring out how to make my code reusable.
I have an XML file that hold the data for each Tag element. Tag element should have child nodes ...
4
votes
2answers
57 views
TabController for handling opening and closing of tabs
I created a class TabController to handle opening and closing of tabs. It needs some data from my viewModel, so should I pass in ...
4
votes
1answer
189 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
115 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 ...
4
votes
1answer
90 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
229 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 ...
4
votes
2answers
98 views
Same function, variable parameters and types with lambda
In my current project, I find myself using Dispatcher.Invoke a lot. Before each call I test if the current dispatcher is the right one. I want to write a wrapper ...
4
votes
2answers
3k views
Is this an effective way of populating a datagrid of comboboxes
The goal is to have a DataGrid of comboboxes, 10 rows, 3 columns. Here's the XAML to create said grid:
...
4
votes
1answer
5k views
WPF circle and line drawer solution
I've created a WPF program which can draw lines and circles on a canvas. It works well, but I don't think it's the best solution. How can I make it work better? How would you create this program?
...
4
votes
1answer
758 views
Putting items next to each other
So I want to put some text next to it's lable.
(both of which are text blocks - which are faster than lables as I understand it)
The best way i've found for doing this is a strack panel.
So I have, ...