Hi,
I need some advice on implementing UIs in WPF.
So far, I've been using Code-Behinds, which is extremely easy to get-started, but hell when maintaining/changing/testing.
I've looked at MVP (and its WPF variant - MVVM), but having some trouble getting started.
Assuming I have a UI to build, here's what I think I should do:
1.
Crea...
I have a 'File' MenuItem were I would like to display a list of recently opened files.
Here is the xaml I have now:
<MenuItem Header="File}">
<MenuItem Header="Preferences..." Command="{Binding ShowOptionsViewCommand}" />
<Separator />
<ItemsControl ItemsSource="{Binding RecentFiles}">
<ItemsControl.ItemTemplate>
<DataT...
I have a parent view that defines a child view in Xaml. The child view has a dependency property that is bound to the parent view's ViewModel. However, that value is also needed by the child view's ViewModel.
<custom:Parent>
<custom:Child ChildId="{Binding ParentFooId}" ... />
</custom:Parent>
ChildId is implemented as a dependenc...
I'm currently introducing Prism to a new Wpf application, and am using the MVVM pattern. My initial approach of structuring the Wpf application was to add one project to hold the model classes, one to hold the viewmodel classes, etc. These might be split at a later time to avoid having different logical components in the same project. Ho...
I'm a C#/Windows Forms programmer with more than 5 years experience. I've been investigating WPF using the MVVM (Model-View-ViewModel) design pattern. I have searched the Internet for tutorials. I have even watched the entirety of Jason Dolinger's awesome video. Although I have found many, I have not found one that takes me from start to...
I am developing an application with the MVVM model, but I have reached a point where I need to choose which framework to use.
Among the possible options are:
MVVM Toolkit
MVVM Foundation
WPF Application Framework (WAF)
Light MVVM
Caliburn
Cinch
Prism
In your experience, which is better?
...
Hi,
I'm using M-V-VM and have a command on my ViewModel called 'EntitySelectedCommand'.
I've trying to get all the Items in an ItemsControl to fire this command, however it's not working.
I think it's because each items 'datacontext' is the individual object the item is bound to, rather than the ViewModel?
Can anyone point me in the ...
I'm still trying to wrap my head around MVVM. Let's say I have a Model that looks something like this:
public class Company
{
public IList<Division> Divisions { get;set;}
}
public class Division
{
public string Name { get;set;}
public IList<Department> Departments { get;set}
}
public class Department
{
pub...
I have a ListControl that is populated with an ObservableCollection. I've also got a "Add new item" text box on the usercontrol as well. When I enter text into the textbox and click "Add" the item goes through the appropriate logic and adds to my ObservableCollection, which my ListControl reflects immediately. So far, so good.
HOWEVER. ...
I've an WPF application where tried to implement MVVM pattern and Prism 2. I have a Usercontrol which has subscribed to an event fired from another Usercontrol. I would like to toggle visibility of few child elements in the subscribing control. Events are fired properly, even I am successfully able to bind data to some elements. How do I...
How do I close a View from its ViewModel?
I've a WPF window which has defined multiple Regions and being used as a Shell to host views for my application. I would like to have a View able to remove itself from the Region, or close it from a tabbed container. How can I accomplish this behavior from ViewModel.
...
Hi
I'm using the LinqtoSQL for a WPF M-V-VM application, as I might want to change from LinqtoSql to something else in the future, like Entity framework or Subsonic etc, thus I found repository pattern to be helpful,
My question is how do I create the model classes, suppose I have an table in the database, I understand that I cannot u...
Here's the scenario:
I have the following user control, the idea is that it's view model should be able to signal to the view that it needs to "Activate the Glow", thereby playing the Storyboard.
<UserControl x:Class="View.UnitView" ... >
...
<Storyboard x:Key="ActivateGlow">
...
</Storyboard>
...
<!-- INVALI...
I would love to be able to use a regular MouseBinding to capture a CTRL-Click event on my TextBlock. Unfortunately the Command property is not a dependency property and I'm using MVVM, so I can't bind it to my viewmodel.
How could Microsoft have left out this basic functionality? Are there no easy ways to detect CTRL-Clicks and bind the...
I have a tree structure to be displayed on a WPF TreeView. The tree structure is shared between multiple parent ViewModels, but the check state will be different for each.
Is it possible to make the TreeView use one ViewModel to create the tree nodes, and the CheckBoxes contained therein refer to a different ViewModel/whatever to determ...
Hi, I'm currently working on a brownfield application, it's written with winforms,
as a preparation to use WPF in a later version, out team plans to at least use the
MVVM/Presentation model, and bind it against winforms...
I've explored the subject, including the posts in this site (which i love very much),
when boiled down, the main a...
I've got two ListBox's with objects as an ItemsSource populating them. Right now, I'm using a DragDropHelper to let me drag an object from one ListBox to the 2nd ListBox. I run custom code to change an attribute on the Object and update my two ListBox collections of objects.
However, now I want to be able to drop one of these objects on...
I've been looking through the PRISM 2 samples for ideas about how to best approach a new application I'm working on, which will be a PRISM 2/WPF app. Looking in particular at the View Injection sample application that ships with PRISM I've noticed that all of the views implement an interface which allows the presenter (or ViewModel) to i...
Hi,
I've got a VehicleViewModel that has a sub ViewModel of NotesViewModel
public IManageVehicleNotesViewModel NotesViewModel { get; set; }
On the first activation of VehicleViewModel I activate the sub ViewModel.
NotesViewModel.Activate();
The activation calls a method to init a number of Commands, I've break pointed this and its...
I keep reading about the benefits of using MVVM, especially for unit testing. So, now I need to write unit tests for my ViewModel. Does anyone have any examples of this? Should I just generate the unit tests using VS2008 and select those tests that appear important?
...