How to bind a WPF hyperlink in a richtextbox to a command?
With the MVVM pattern, how does one go about dynamically binding an ICommand to the click event of a hyperlink inside of a RichTextBox? ...
With the MVVM pattern, how does one go about dynamically binding an ICommand to the click event of a hyperlink inside of a RichTextBox? ...
I have an MVVM application with various TextBox controls and a virtual keypad. (This application is to run on a touch screen system, with no keyboard). To change the value of a TextBox, the user has to touch the TextBox and then use the virtual keypad to enter a number. How can my VM know which TextBox to change when it gets the command ...
I am not understanding how my model can be a WCF service. It makes sense when its an Astoria partial class residing on the client that allows remote calls to do persistence calls, but a WCF service doesn't have properties for model fields that can be used to update a data store. Even if I could factor out an interface for a model/dom...
Why is that when I define a view with data context in this way: <views:MessageView DataContext="{x:Type presenters:MessagePresenter}"/> that my MessagePresenter does not run its constructor? What is the syntax to define view/presenter pairs like this in XAML? ...
I'm just starting to dig into the MVVM pattern for WPF but because I'm not a professional developer, I sometimes feel a little lost. The main problem I have is deciding who should create whom: Let's say I have a database storing dogs and cats. I would then have a DatabaseManager which communicates with the database (Unit of Work!?), a D...
Where should validation reside when using ViewModels with MVC (MVVM), on the Model or the ViewModel? (Or both or neither)? And why? I bring this up especially in light of V2 of ASP.NET MVC coming out soon. What about complex/custom validation? ...
I've implemented the MVVM pattern and have some viewModels that are bound to tab pages on a tab control. When a specific object type changes (i.e. from Car myVehical, to Bike myVehical), then i want the relevant tab page to become selected. Thanks. ...
I've seen a few articles on unit testing view models in MVVM and how the tests themselves are consumers of the view models, testing the functionality of the viewModel and model. However, I'm left wondering how I go about testing the views (UI) to ensure they are wired up to my view models properly. I don't want to write a test that, fo...
Hello! Please, don't judge strictly if this question was discussed previously or indirectly answered in huge nearby prism and mvvm blogs. In WPF implementation of RelayCommand or DelegateCommand classes there is a such eventhandler /// <summary> /// Occurs whenever the state of the application changes such that the result of ...
Is there a standardized way to sync a collection of Model objects with a collection of matching ModelView objects in C# and WPF? I'm looking for some kind of class that would keep the following two collections synced up assuming I only have a few apples and I can keep them all in memory. Another way to say it, I want to make sure if I ...
Hey guys, I've got what I think is an interesting question: You all know and love the Skype chat interface: each message is enclosed in a bubble, with emoticons and link capabilities, as well as an avatar at the left. What is the most ideal WPF component to house each message in, if I were creating a Skype-like interface? I am using...
Hey Databinding in WPF is great, but the moment you try make things more complex it gets exceedingly difficult to implement things. I have a collection of objects, where each object has observable properties that are bound to a user control. I would like to (ideally) simply add a new object to my collection, and have a new user contro...
What is the simplest example of binding the items of a TabControl to an ObservableCollection? Each tab's content will have unique data, and indeed this data will have observableCollections of its own bound to the items components. Currently I have a user control, which I would like to set as the content of each tab as soon as it is cre...
Hi, I'm working on a WPF MVVM application. The thing that I'm noticing is that I have to write an inordinate amount of boilerplate code just to declare commands (through DelegateCommands from the WPF Team's MVVM Toolkit), attached properties and attached behaviors. Are there any strategies available to reduce the amount of boilerplate c...
I have the beginnings of my first Silverlight MVVM app and need to know where I should put business logic including async service calls. Does it go on the page hosting the view? Do I simply set a property of the ViewModel which updates the view? ...
Hi I'm fairly new to mvvm and I have several questions : is model = business layer? if i have a customer model that contains list of orders and list or orders each contains list of items, how would you separate this in a view? At the moment, my CustomerModel have a CustomerViewModel. CustomerViewModel contains list of OrderViewModel....
I have a very flat-structured treeview with only two levels of items - the main ones, and one level of subitems. I am using WPF MVVM and would like a way to style the two levels differently, but have no idea how. I bind the treeview to an ObservableCollection in my ViewModel, and each element has one more ObservableCollection for the ne...
I am currently working on a project of mine which is a MSPaint-like WPF application. However I don't paint with pencil tools or something similar but with objects (Rectangle, Circle, Triangle etc.). I use Prism and the MVVM model to achieve testability and maintainability. I've now run into a problem. I have a CanvasView.xaml that's (as...
I have implemented a selection pattern similar to the one described in this post using a ViewModel to store the IsSelected value, and by binding the ListViewItem.IsSelected to the ViewModel IsSelected. <ListView.ItemContainerStyle> <Style TargetType="{x:Type ListViewItem}"> <Setter Property="IsSelected" Value="{Binding Mode=...
I've got a collection of ViewModels that are rendered as tabs using a style to pull out the relevant content to display on the tab: public class TabViewModel : DependencyObject { public object Content { get { return (object)GetValue(ContentProperty); } set { SetValue(ContentPropert...