We're looking at patterns such as MVP that can help make us seperate UI from logic from data. The initiative is late in the game, but is an effort to begin to set rules that we need to write more testable code (currently we write hairballs, spaghetti, duct-tape and wood screws, etc.)
As we look to the approaches to take with out 2.0 ...
I'm having trouble getting the Dispatcher to run a delegate I'm passing to it when unit testing. Everything works fine when I'm running the program, but, during a unit test the following code will not run:
this.Dispatcher.BeginInvoke(new ThreadStart(delegate
{
this.Users.Clear();
foreach (User user in e.Results)
{
t...
i have a mvvm app that the main window is a tab control.
i use the itemssource to bind items to the combo box,
everything works fine until i go to another tab and for some reason the selected item of the combo box getting the null value, any ideas ?
the binding is twoway updatesource onpropertychanged and the property is type of observa...
I'm trying to implement the MVVM pattern in WPF. I've followed Jeremy Alles's Very simple MVVM demo application. I have a ListBox that has a binding to an ObservableCollection:
<ListBox
Name="myListBox"
IsSynchronizedWithCurrentItem="True"
ItemsSource="{Binding Persons}">
<ListBox.ItemTemplate>
<DataTemplate>
...
the best way to explain is with example so:
this is the model
public class Person
{
public int age;
public string name;
}
this is the view model
public class PersonVM
{
}
my question is:
should the vm expose the person to the datga template or encapsulate the model properties with his own properties?
...
I have this ItemsControl in my View:
<ItemsControl
ItemsSource="{Binding ItemPageItemViewModels}"
ItemTemplate="{StaticResource ItemPageItemViewModelsTemplate}"/>
And above it I have this DataTemplate which renders all the items:
<DataTemplate x:Key="ItemPageItemViewModelsTemplate">
<TextBlock Text="{Binding Title}"/>
</...
How can I do this in XAML:
PSEUDO-CODE:
<TextBox Text="{Binding Password}" Type="Password"/>
so that the user sees stars or dots when he is typing in the password.
I've tried various examples which suggest PasswordChar and PasswordBox but can't get these to work.
e.g. I can do this as shown here:
<PasswordBox Grid.Column="1" Grid....
My concept for MVVM in WPF is that we have a ViewModel for every Model in your application. This means that if we have Customer class (entity) then we will have CustomerViewModel. The CustomerViewModel will have all the properties which are necessary to represent a customer. The CustomerView usercontrol will be responsible for creating t...
This is a situation that comes up often:
In the View, you have a control bound to a ViewModel property (backed by a INotifyPropertyChanged). For example:
<TextBlock Text="{Binding Path=Subtotal}"/>
When the property changes, you need to bring the user attention to the fact with some creative animation. How I can utilize the fact that...
In implementing M-V-VM in a project and following advice of Karl Shifflett about implementing a validation framework, but don't really want to use a full framework (like Ocean) only for the validation part.
What validation framework do you recommend that works with the M-V-VM pattern?
...
I have a hierarchy of view models representing formatted content:
public abstract class ContentPartViewModel : ViewModel
{
}
public class TextContentPartViewModel : ContentPartViewModel
{
public string Text { ... }
}
public class TitleContentPartViewModel : TextContentPartViewModel
{
}
public class HyperlinkContentPartViewModel :...
The big picture: I have a custom child control that generates various textboxes, datepickers, combo etc based on properties that I set. This control is embedded in various places within my SL application.
I generally use the MVVM pattern, and I want to bind the values of these dynamic controls back into my master page view model.
I al...
Hi.
I've recently made an UserControl, which took quite a long time, because I had to work with custom Dependency Properties and so on...
Anyways, it was just a bunch of 3 controls: TextBox, Popup with Hierarchical Tree.
Now I realized I could probably write a ControlTemplate only. Hence what is the benefit of using UserControl?
...
Note: This is a long winded question and requires a good understanding of the MVVM "design pattern", JSON and jQuery....
So I have a theory/claim that MVVM in DHTML is possible and viable and want to know if you agree/disagree with me and why. Implementing MVVM in DHTML revolves around using ajax calls to a server entity that returns J...
Hi, I've been reading up on the MVVM pattern, and I would like to try it out on a relatively small WPF project. The application will be single-user. Both input and output data will be stored in a "relational" XML file. A schema (XSD file) with Keys and KeyRefs is used to validate the file.
I have also started to get my feet wet with Lin...
I have a ViewModel class which has large number of properties(Say 50). Once the data is set on to all the properties I need to update the UI. I know that the common solution is to raise PropertyChanged on all the property setters.
I am wondering if there is any way I can notify my DataTemplate to update all its bindings through a singl...
I've currently noticed that many people start using this model very often. Anyways, I think it's very correct to separate logic from presentation.
What more, some functionalities cannot be accomplished without it, or just very hardly.
Consider a Tree that is selectable, has search capabilities etc..
But in some cases, you don't need to ...
I have quite a large number of parent-detail ViewModels in my MVVM application. Something like this:
SchoolsViewModel
+- SchoolViewModel
+- LessonViewModel
+- PupilsViewModel
+- PupilViewModel
+- TeacherViewModel
+- PupilsViewModel
+- PupilViewModel
+- LessonsViewMo...
All of the WinForms wizards I've written in the past have a high degree of coupling between the UI and the model. That is: the individual pages know about enabling/disabling the Next/Previous buttons, how to react to the Next button being pressed, etc. It makes it all hard to test, because to test any of the logic, you've got to put a lo...
I have quite a large number of parent-detail ViewModels in my MVVM application. Something like this:
SchoolsViewModel
+- SchoolViewModel
+- LessonViewModel
+- PupilsViewModel
+- PupilViewModel
+- TeacherViewModel
+- PupilsViewModel
+- PupilViewModel
+- LessonsViewMo...