Hi all,
I have an problem and would like to know if it is common problem or jsut with me. I am using Wpf with Prism and Unity, all with the pattern MvvM.
I am loading a viewModel that has a reference to a dropdown with few items, my idea is that each time that the user click in some place to open the view that has this dropdown is that...
I've seen quite a few examples of MVVM. I can see that the View should reference the ViewModel. I've seen recently an example of a ViewModel referencing a View, which seems wrong to me, as it would result in tighter coupling. Given that ViewModel is often described as an intermediary between the View and the Model, is there more to the V...
I have two datagrids side by side bound to different data tables and each with their own view.
The datatables both have the same number of rows, and I want both grids to maintain the same scroll position.
I am having trouble finding a way to do this using MVVM... anyone have any ideas?
Thanks!
-Steven
...
Did I miss something?
1- Style
<Style TargetType="{x:Type TextBox}">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=Validation.HasError}" Value="true">
<Setter Property="BorderBrush" Value="Blue" />
</DataTrigger>
</Style.Triggers>
<Setter Property="MinWidth" Value=...
I thought what I was doing was right out of the Josh Smith MVVM handbook, but I seem to be having a lot of problems with value converters firing when no data in the view-model has changed.
So, I have a ContentControl defined in XAML like this:
<ContentControl Grid.Row="0" Content="{Binding CurrentViewModel}" />
The Window containing ...
Hi all
I have written a MVVM prototype as a learning exercise and I am struggling to understand how I can communicate between views.Let me explain
I have a treeview on the left (leftSideView)
ListView on the right (rightSideView)
MainWindow (includes the 2 views mentioned above and a splitter)
What I have implemented does not work a...
I have implemented MVVM in my WPF application. I was wondering what is the correct way to consume a Web Service from WPF MVVM app.
So far, I have created a DataAccess interface and a class that implements this interface. This would serve as a facade / proxy to the web service. The ViewModel gets a reference to this class as the constru...
I have a window named ParameterEditorView with a ParameterEditorViewModel as DataContext. In the ParameterEditorViewModel I have a list of ParameterViewModel. In the ParameterEditorView I have an ItemsControl whose ItemsSource is binded to the list of ParameterViewModel in the ParameterEditorViewModel. I need the ParameterViewModel to ha...
Hi,
I'm writing an application in WPF, using the MVVm toolkit and have problems with hooking up the viewmodel and view.
The model is created with ado.net entity framework.
The viewmodel:
public class CustomerViewModel
{
private Models.Customer customer;
//constructor
private ObservableCollection<Models.Cust...
Hi,
I have a wpf datagrid with many rows, each row has some specific behaviors like selection changed of column 1 combo will filter column 2 combo, and what is selected in row 1 column 1 combo cannot be selected in row 2 column 1 combo, etc...
So I am thinking of having a view model for the main datagrid, and another for each row.
Is ...
I am coming across a scenario where I need to do something in the viewmodel according to the current selection in the view, but according to MVVM, the view model should not know about the existence of view, then how can i get the dynamic selection in the view?
...
Hello,
I am using http://loungerepo.codeplex.com/
this library needs a unique id when I persist my entities to the repository.
I decided for integer not Guid.
The question is now where do I retrieve a new integer and how do I do it?
This is my current approach in the SchoolclassAdministrationViewModel.cs:
public SchoolclassAdminist...
It seems nobody has yet found a way to set the comboboxitem as selected with a SelectedItem="Binding Property".
Is the solution to use a IsSelected Property in the ViewModel object within the combobox itemssource ?
...
I found two ways to use M-V-VM pattern in WPF:
allocate the ViewModel into the View's code behind (setting it as the DataContext);
allocate the ViewModel into a XAML file and create the corresponding view using a DataTemplate.
The Model can be allocated into the ViewModel's constructor.
What do you think about this way of using M-V-...
Hello,
I have a user control called HomePage.xaml. I'm creating a model instance (using MVVM pattern) in the code behind file in the constructor of page as
MainViewModel model = new MainViewModel();
I have a button in HomePage.xaml which I want to bind to the command inside MainViewModel called GetData() and want to populate the data...
Hi,
I'm trying to display the data from two sql ce 3.5 sp1 database tables linked with foreign key - Customers and Orders. When the customer is selected in a datadrig, I want the other grid to be populated with the Orders.
I'm using a query:
var profiles = from c in db.Customers.Include("Orders")
select c;
A...
My ViewModel:
class ViewModel
{
public string FileName {get;set;}
}
and in my View I bind a label's content to ViewModel's FileName.
now When I do drag-drop a file to my View, How can I update the label's Content property, so that the ViewMode's FileName also get updated via binding?
Directly set the label's Content property won't w...
I have a combo box that I have bound to a list that exists in my viewmodel. Now when a users makes a selection in that combo box I want a second combo box to update its content.
So, for example, combobox1 is States and combobox2 should contain only the Zipcodes of that state.
But in my case I don't have a predefined lists before hand ...
With MVVM, I think of a view-model as a class that provides all the data and commands that a view needs to bind to.
But what happens when I have a database entity object, say a Customer, and I want to build a class that shapes or flattens the Customer class for use in a data grid. For example, maybe this special Customer object would ha...
Hi,
I'm creating a wpf user control which is in mvvm pattern.
So we have : view(with no code in codebehind file), viewmodel,model,dataaccess files.
I have MainWindow.xaml as a view file, which I need to bind with MainWindowModel.cs.
Usually, in a a wpf application we can do this with onStartUp event in App.xaml file. But in user contr...