In My ViewModel class I have a property:
class ViewModel : INotifyPropertyChanged
{
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...
I'm trying to build a sample game in Silverlight 4 using the MVVM design pattern to broaden my knowledge. I'm using Laurent Bugnion's MvvmLight toolkit as well (found here: http://mvvmlight.codeplex.com/ ). All I want to do right now is move a shape around within a Canvas by pressing specific keys. My solution contains a Player.xaml (...
Why is the unit test useful when the view is not unit testable in MVVM?
In MVVM, we have the models, view-models, and views. The claimed advantage is that MVVM can make the models and view=models unit testable. But all the three parties belong to the same application. If the views are not unit testable, why test the other two? Will unit...
I am trying to bind a 2D array of buttons arranged in stackpanels to a 2D ObservableCollection...
Yet, I'm afraid I don't understand something very elementary about binding.
My XAML:
<Window.Resources>
<DataTemplate x:Key="ItemsAsButtons">
<Button Content="{Binding}" Height="100" Width="100"/>
</DataTemplate>
<...
As I wrap my head around the mvvm thing, the view is the view, and the viewmodel is 'a modal of a view' and the model are the entities we are dealing with (or at least that is my understanding). But I'm unclear as to what and when the model entities are populated. So for example:
Lets say I have app that needs to create a new record i...
Hello,
I have a datagrid with master detail implementation as follows:
<data:DataGrid x:Name="dgData" Width="600" ItemsSource="{Binding Path=ItemCollection}"
HorizontalScrollBarVisibility="Hidden" CanUserSortColumns="False" RowDetailsVisibilityChanged="dgData_RowDetailsVisibilityChanged">
<da...
In a MVVM approach how would I go about binding to Properties.Settings? Is there a way to bind a property in C# code(in the ViewModel) to another property(Properties.Settings.Default) or should i just bind to standard properties and on save make sure each property gets propogated manually to the Properties.Settings?
...
Hello,
I have been searching on how to navigate through the pages in silverlight 4 (navigation application) when I have implemented MVVM pattern. But nothing I found satisfied me.
I have a main page which has frame in it. In that frame I load home page which does simple URI mapping. But now I want to go to New Page on button's click ev...
I have a ViewModel, it takes two parameters in the constructor that are of the same type:
public class CustomerComparerViewModel
{
public CustomerComparerViewModel(CustomerViewModel customerViewModel1,
CustomerViewModel customerViewModel2)
{
}
}
public class CustomerViewModel
{
publ...
It seems that the XAML in MVVM pattern has difficulty to pop-up a Messageboxes. My client insists that the validation labels and colors are not good for them. They still want a messagebox. How can do it?
I know I can pop-up messageboxes in the view-model, but it violates the whole purpose for the view-model. I can also raise a error, an...
I have aggregated models like Customer:Order:Product.
As my View is bound to the BillingViewModel which has a Property Customers of type ObservableCollection
and ONE customer in this collection has a "list" of orders
named ObservableCollection
and ONE order in this collection has a "list" of products
named ObservableCollection
Well ...
I want to use UserControl as the base for my views, but I cannot add functionality to my views because they are based on UserControl.
How do I create my own view class by using a subclassed version of UserControl.
...
I'm trying to create a View in WPF and having a hard time figuring out how to set it up. Here's what I'm trying to build:
My ViewModel exposes an IEnumerable property called Items
Each item is an event on a timeline, and each one implements ITimelineItem
The ViewModel for each item has it's own DataTemplate to to display it
I want to ...
Hello,
I have a Customer with Orders and those have products. Everything aggregated with collections of type ObservableCollection.
All 3 collections are bound to a datagrid/combobox.
I can only make the root collection (ObservableCollection Customers{ get;set;} )
passing to a CollectionView so I can move the current customer within t...
I can think of two ways to implement dependency properties that are shared between the detail views:
Store them in the master view model and add data bindings to the detail view models when they are created, and bind to them in the detail view.
Don't store them in the view models at all, and use FindAncestor to bind directly to propert...
I have an entry-point View with a tab control. Each tab is going to have a user control embedded within it. Each embedded view inherits from the same base class and will need to be updated as a key field on the entry-point view is updated.
I'm thinking the easiest way to design this page is to have the entry-point ViewModel create and...
Hi,
I have a WPF user control ...which is in MVVM. The user control(which contains a listview) need data from the page (where it is included). I have to set a property to get this data input. Will this comply with MVVM...if not, what is the way for the same?
...
Can anyone tell me,Please include code, how to select a treeviewitem using the MVVM Pattern
...
A while ago, I posted a question regarding switching between a Blend-authored GUI and a Visual Studio-authored one. I got it to work okay by adding my Blend project to my VS2008 project and then changing the Startup Application and recompiling. This would result in two applications that had completely different GUIs, yet used the exact...
After adding "RelayCommand" class (that uses CommandManager class) into my Silverlight App I've got an error:
The name 'CommandManager' does not exist in the current context
This class is a member of System.Windows.Input namespace that is in PresentationCore.dll assembly. The problem is that I can't add this dll into my app...
I a...