I have a ViewModel in WPF that looks something like this:
public class SwatchViewModel
{
public ObservableCollection<Color> Colors { get; private set; }
}
I want to display each of the colors in the collection, laying them out in columns. Each of the columns should take up the same amount of space in the control and all columns co...
MVVM question.
Messaging between ViewModel and View, how is it best implemented?
The application has some points of “user communication” such as: “You have entered comments for this selection. Do you wish to save or discard” when the value of a Yes/No/NA selection changes.
So I need some proscribed way of the View binding to the ViewM...
Hi,
I'm currently playing around with a MVVM/Commands and ControlTemplates.
What I'm trying to do is quite simple. I want to have a list of e.g. Persons, where the user can trigger an action on each of them.
But the event/commandhandler needs to be executed not on the person object e.g. because I want remove it from the list with a but...
I have recently started investigating the MVVM pattern with WPF for an upcoming project. I started with Josh Smith's MSDN article. I have a question (well many, but let's start with one):
I have an IndividualViewModel which exposes the properties of the model. I need two views "Add Individual" and "Edit Individual" which are very simila...
I'm would like to use both EF and MVVM and am trying to see how they fit together. I can't find much in the way of examples so hope you guys can answer a few questions.
Let's say I have a single table in a database called Customer. I run the EF designer and get a data model.
The next step is to run some linq to get data out of the data...
I have a datagrid bound to a CollectionViewSource view in my view model. The datagrid has a CheckBoxColumn and three TextColumns, each bound to properties in the items in the view. I also have a bool property "Enabled" in the view item that I would like to use to make checkboxes in individual rows not visible. As an added bonus, it wo...
I'm still working on modifying my existing WPF application to be "compliant" with the MVVM approach. I'm getting pretty darned close, but am not sure how to solve one of remaining few hurdles.
I have a GUI element (currently a button, though it could be a label), where when the mouse enters it, it fires the MouseEnter event, and this c...
I am creating a form using wpf/c#. I am looking to programatically change/interpret the user's typed input in the wpf toolkit DatePicker.
For example, the user types "Today", and when the control looses focus the date is interpreted and set to the current date using my c# function.
Should I listen to the lostFocus event or is there a...
As I knock off more and more MVVM-related issues with my current application, more just keep popping up. :)
The current implementation that I am trying to replace involves a StackPanel whose children are more or less dynamically generated (via looking in a configuration file). Each child is an instance of a UserControl. Before, what ...
In a previous post, I was advised to use a DataTemplate to render a group of Buttons and Labels, and it works wonderfully. The problem is that I have several of these groups of Buttons, and I would like to distinguish one group from another. I plan to use the AlternatingIndex to color each group differently, but that's not enough -- ea...
I am using WPF toolkit Datagrid. I have a rowvalidationrule defined on this. to trigger this validation rule, on each cell update i have to hit enter button. but i want to check this on each cell update without hitting Enter button. How can i do this. this is a MVVM app.
Thanks,
Rey
...
Let's say in some abstract ViewModel base-class I have a plain-old property as follows:
public Size Size
{
get { return _size; }
set
{
_size = value;
OnPropertyChanged("Size");
}
}
I then create a more specific ViewModel, inheriting from the previous one, which contains the following property:
public R...
In a framework for an app that I'm creating, I can have multiple "plug-in" 's added to a "workspace", where they can be rearranged and re-sized as necessary. I want each plug-in to be able to register WorkspaceParameters (global parameters shared by all plug-ins) with a WorkspaceManager (exposed through IWorkspaceManager interface) class...
I have been looking into MVVM recently and I seem to get the overall idea. There are a couple of niggly bits though that I do not fully understand and was hopping to get some answers here, cheers!
Is it incorrect to use one data model for the whole application. Usually if I am creating a small utility I would have all of the logical da...
Hello,
I'm fairly new to the Silverlight and the MVVM / Prism pattern so this may be a stupid question.
I have a View which has custom controls within it. These custom controls are actually Views too and have ViewModels to drive them.
Currently to add these 'child' Views to the View I'm using (see Fig.1) and then in the ViewModel I ha...
hi,
I was trying to bind a dataset to a listbox..certainly because i want to display a couple of tables information in a datatemplate..But this seems not possible and i will have to convert it to an observable collection.But how can i do it.My bl returns dataset objects.How can i convert this to observablecollection..? Is there any way s...
Hello, If anyone can provide some help for this one, I'd be very grateful!
We are using: Silverlight 3 / MVVM / Blacklight DragDock Control / ComponentOne Silverlight Controls
I have a Silverlight application that relies heavily on the MVVM pattern. The application has seemingly been running fine, until recently. I have started to no...
In my application, I instantiate a new instance of my view in its associated viewmodel's constructor. I also have some events to subscribe to with an event aggregator.
public class FooViewModel
{
private FooView TheView { get; set; }
private IEventAggregator Aggregator { get; set; }
public FooViewModel()
{
Aggre...
I have an ObservableCollection of ViewModels that are sitting in a WPF DataGrid. The DataGrid has three columns:
Position column; this is rendered at runtime by a UserControl that displays the position of the row in my DataGrid
Name column; this is rendered at runtime by a UserControl that displays the name of the column (yes, I need a...
Hey everyone,
I'm using MVVM and each View maps to a ViewModel with a convention. IE
MyApp.Views.MainWindowView
MyApp.ViewModels.MainWindowViewModel
Is there a way to remove the DataTemplate and do it in C#? with some sort of loop?
<DataTemplate DataType="{x:Type vm:MainWindowViewModel}">
<vw:MainWindowView />
</DataTemplate>
...