Either I do not see the solution or I found a pitfall in using MVVM.
I have this sample Master-Detail:
class Customer
{
int CustomerID {get;set}
string Name {get;set}
ObservableCollection<Order> Orders {get;set}
}
class Order
{
int OrderID {get;set}
int Quantity {get;set}
double Discount {get;set}
}
Lets assu...
Does .net 4 add anything new for working with MVVM?
...
I have an AutoCompleteBox that uses RIA DomainDataSource for the query to the server. I need to bind the AutoComplete.SelectedItem to the ViewModel.SelectedEmployee. They share the same DomainContext and data, but have different queries. When I try the following:
ViewModel.SelectedEmployee = autoCompleteBox1.ItemsSource;
I get the err...
I've seen this done inside of an event handler directly behind the .xaml file however it doesn't seem like this would follow the MVVM pattern: MainApplication.mainFrame.Navigate(new HomePage());. Is there a better way for handling navigation with the MVVM pattern perhaps in the ViewModel? or in the XAML?
...
Doing something like this:
<DataTemplate DataType="{x:Type vm:AllCustomersViewModel}">
<vw:AllCustomersView />
</DataTemplate>
works in a ResourceDictionary for when I want to apply a ViewModel to a UserControl as root, but how do I the same thing when I have a UserControl inside of a Page? Would I create a ResourceDictionary for all ...
Hello all,
Lets assume I have the following 3 entities: Customer,Order,Product which interact in the View with the CustomerOrderProductViewModel.cs:
I have several controls like listbox,datagrid,etc.. to display those entities in my View.
Those Entities shall be fetched sort of eager loading. That would mean I have 3 sqldatareader in ...
I have an application written using the M-V-VM approach.
The data access is done in the Model. If a fatal error occurs here (for example, the connection to the data source is lost), and Exception is thrown. This Exception bubbles up to the ViewModel.
However, because the original trigger of the data access was a data binding, WPF swall...
I suppose to be able to access the Dispacher that belongs to the View I need to pass it to the ViewModel. Bu the View should not known anything about the ViewModel so how do you pass it? Introduce an Interface or instead of passing it to the instances create a global dispatcher singleton that will be written by the View? How do you solve...
Hi All, Thanks for taking time to read through my question. Any guidance is really appreciated.
I am using SL3 Navigation framework in my LOB application. I m currently using MVVM Light as the framework guidance.
I have a datagrid consisting of employees and when the "user" clicks on "employee id link" in the datagrid, i am transferr...
Kind of an odd question- if I'm thinking of this the wrong way please let me know. I am using an infragistics dock manager, which manages tabs as well. So I can create a TabGroupPane, and then add multiple ContentPanes, each of which has its own tab.
In each content pane, I set my viewmodel:
<ContentPane>
<viewmodels:MyViewModelFor...
I have a View where the user can select "Basic Configuration" and "Advanced Configuration" from a radiobutton group. This view will then display one of two usercontrols (views): BasicConfigurationView and AdvancedConfigurationView. I can solve this by just hiding/showing the views when the user clik on the radiobuttons, but is there a be...
I have a custom control which has the following dependency property
public static readonly DependencyProperty PrintCommandProperty = DependencyProperty.Register(
"PrintCommand",
typeof(ICommand),
typeof(ExportPrintGridControl),
new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.Inherits));
publ...
Hi,
I'm looking into using MVVM and while I understand it for the most part, there is one thing I can't get my head around.
Imagine I have a View and ViewModel combination that show a list of foobars. When the user selects a foobar in the list and clicks the edit button I want the foobar to be shown in a popup dialog window so it can ...
Hi,
somehow I am going in circles here. Please forgive me if the answer to this question is obvious.
I want to react to changed properties in the ViewModel in the View. When the properties (bool) change the View should start an animation (BeginStoryBoard).
Actually in my application there are 4 of these properties each with its own nam...
I've a database consisting of about 1 million records. My application makes frequent incremental search on these records and filters the UI list. The scenario is more like the 'phone contact search'.
Currently i'm following this:
Load the data into List<myModel> in the DataSource Layer`
Send it to MainViewModel
Load List<myMod...
I have a WPF listview, and in one column the cell may contain one or more ListBoxes.
When I right-click a ListBox I'm building a context menu where each item has a DelegateCommand. Currently I'm setting the command parameter to a SelectedListBox property on the page viewmodel itself as my delegate command needs to know which ListBox has...
Hi all,
since my title is buzzword compliant I hope I will get lots of answers to my question or any pointers to the right direction.
OK what I usually do is have a ViewModel which contains a list of ViewModels itself.
public class MasterViewModel
{
public ObservableCollection<DetailViewModel> DetailViewModels { get; set; }
pub...
Hi,
I have a WPF app that is using the MVVM pattern. Hooking up buttons to the VM is pretty straight forward since they implement the ICommand. I have a context menu that works similar. The next step is to create shortcut keys for the context menu. I can't figure out how to get the shortcut key invoke the Command. Here is an example:
...
Using the MVVM pattern creating WPF applications you have the ViewModel providing data to the View. I've met a situation where I find it reasonable to create WPF objects in my ViewModel, and the View fetches these and shows them. More specifically I have functionality for drawing where I need to store an InkPresenter in the end. I receiv...
In MVVM development I am constantly converting List<T> from my models to ObservableCollection<T> for my views.
I looked around in .NET for a way to succinctly do this e.g. such as .ToList<> or .ToArray<> or .ToDictionary<> but couldn't find anything similar for ObservableCollection.
Therefore I made the following extention method Conve...