I have recently parametrized my ViewModel's contructor. Before that, I was doing this in my window:
<Window.DataContext>
<vm:MyViewModel />
</Window.DataContext>
The framework instantiated the ViewModel for me.
I know I can set DataContext in code but I would prefer a XAML way so designer can display my test data when designing.
...
Hi,
I am coding a WPF application using MVVM pattern. I don't need to have codebehind files for my user controls. What is the best way to remove these files elegantly?
I can create a user control class then I can use this class for my all views. (for more info: http://sondreb.com/blog/post/No-Code-Behind-for-MVVM.aspx)
Are there any a...
Hello, everyone. Here is my question. I'm using MVVM pattern in my project and i have a UserControl, which has a TabControl on it. TabItems have validations on them.
Main page looks like this:
<UserControl>
<DataInput:ValidationSummary x:Name="ValidationSummary"/>
<Grid x:Name="LayoutRoot">
<DataInput:ValidationSummary ...
I have a window with 3 textboxes in a grid -this is my view- and I have Save button to add a new user to my user list with the datas from the textboxes.
I want to use a relay command to do this on my viewmodel class but I am quite confused with how to make the bindings. I hope it's clear enough. Any ideas, or examples will be helpful.
t...
Hi All
am creating a buttons dynamically.In my MainView.xaml,am binding these buttons to Canvas with contentcontrol here all buttons are generating as a single control now i have to spit those controls to use..
how can i do this?
here is my canvas code
Canvas Background="White"
Height="421" HorizontalAlignment="Left" Ver...
Hi,
How can I bind a collection of Commands in viewmodel to a toolbar in related view?
...
Is it possible to fire a command to notify the window is loaded.
Also, I'm not using any MVVM frameworks (Frameworks in the sense, Caliburn, Onxy, MVVM Toolkit etc.,)
...
I come up against this decision frequently and I constantly vacillate on what approach to take.
Many MVVM examples have the model being passed into the constructor of the view model. Hence every VM is coupled to a Model. The logic to retrieve the Model and create the VM is outside of the VM "somewhere". Model has to know how to persist ...
Hi,
I have a custom user control, and it has a dependency property. That custom user control is kind of complicated so I decided to make a view model for it, but I haven't implemented it yet. I'm thinking of making the view model having some properties which are bound to the custom user control.
Here is my code sample,
-UserControl....
Hi.
I'm creating my first application using MVVM. I'd like to have a usercontrol that shows the results of some functions. Something like VS Error List.
I.E. if I choose some xml file in some other usercontrol and try to deserialize it, I'd like to have on this notification list some info like "Deserialization complete" or "Deserializ...
I'm working with MVVM and instead of reinventing the wheel, I thought I could find an open source view model base class. I can't find one.
...
I have a list that I populate in the init of my viewmodel:
ListOfEmployees = new List<EmployeeBO>(employeeRepository.GetEmployees(true, true));
I am trying to get a combobox in a datagrid to populate from this list.
<DataGridTemplateColumn Header="U/M" MinWidth="145">
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
...
I'm on a Silverlight 4 + MVVM project using ASMX for services.
I'm finding the DataForm to be cumbersome. IEditableObject, bindings, etc seem to be a pain. I've done some forms in my application without the DataForm and they've worked out really well.
So I guess my real question is, what does the dataform give me that hand bombing a ...
I have two ViewModels WindowViewModel & StatusBarViewModel. i want to updatethe property StatusBarVM in WindowViewModel when there is a change in StatusBarViewModel instance
Following is the property in WindowViewModel
public StatusBarViewModel StatusBarVM
...
Hi,
In MVVM pattern, how to notify all properties of the view model has changed? I don' t want to call all notifypropertychanged event of all properties.
I have an entity class and in view model I wrote all of the public fields of the entity as public properties. I want to rebind new entity and just write a single line of code to noti...
Hiexperts,
trying to grasp the concepts behind the MVVM pattern, I'm playing around with Josh Smiths MVVM sample application (http://msdn.microsoft.com/en-us/magazine/dd419663.aspx).
The sample app has a HeaderedContentControl where all the commands from the MainWindowViewModels Commands property are displayed. I'm struggling right no...
i have three listboxes, whose itemsSource is binded to a list, list and dictionary. i want to add the selected user and selected book to the dictionary with a command but i can't take the selected items. i am trying to obey the mvvm. i have a booklist and a userlist in my viewmodel which are binded to the given listboxes in my view. i co...
I've been reading up on MVVM and so far have found it very interesting. Most of the examples I've found, however, are for Windows apps, as opposed to Web apps. I've also seen a lot of mention of MVVM used with Silverlight, and I know Silverlight can be used for either Web or Windows apps.
So my question is - is MVVM a valid pattern for ...
Doing my first MVVM WPF application. I expected to see a Main() method in the App.xaml (I'm used to Silverlight) but it isn't there. I added my own Main method. In Silverlight I then created a View linked to a ViewModel and set it as the RootVisual. How do I correctly open my first View Window in WPF?
...
This is probably overkill on the MVVM pattern but it's new to me and I'm interested to see if it is possible.
If I attach to the MouseMove event for a Window and do DragMove, I can move a bordeless window. Can I achieve this by some other method in MVVM or should I just accept adding this code to the Window's codebehind?
...