I have a View that has a single textbox and a couple buttons below it. When the window loads I want that textbox to have focus.
If I was not using MVVM I would just call TextBox.Focus() in the Loaded event. However my ViewModel does not know about my view so how can I accomplish this without putting code into the codebehind of my view?...
I'm pretty sure someone will have done something like this before but have been hitting my head on this for a few days now, with little headway.
I have a WPF form which is being used to compare trades. The trades differ on certain "break" fields. The form is to be used to select one "lead" trade and one of the remaining trades is select...
i have a mvvm app that retrieve a lot of data from remote server.
i wanna add an animation while data is being loaded
what best way of doing that.
...
I have a WPF application using MVVM. I have some user controls that show some SSRS reports in a ReportViewer control hosted within a windows forms host control.
The User Control has a simple combobox where the user selects a criteria and therefore the report satisfying this criteria will be loaded, its data fetched from the database and...
I have a WPF application using MVVM. I have some user controls that should show a Person FirstName, LastName and email in 3 Textbox controls using simple databinding.
The User Control has a simple combobox where the user selects the ID for the user and therefore the Person Record with that ID should be loaded (its data fetched from the ...
I read this article today http://dotnetslackers.com/articles/silverlight/Silverlight-3-and-the-Data-Form-Control-part-I.aspx about the use of the MVVM pattern within a silverlight app where you have your domain entities and view spesific entities which basically is a subset of the real entity objects. Isn't this a clear violation of the ...
We have a solution with two different projects, one with the requirement that it be done using the .Net 2.0 framework. The other uses .Net 3.5, and we follow MVVM, though I suspect this is less about MVVM than good patterns.
The .Net 2.0 has several different objects (let's say of type Fruit) which could potentially require a different ...
Hey atAll!
Often found answers here, but now it`s my first time ;)
We use the MVVM pattern in conjunction with DelegateCommands. So normally I bind a command to the button like this:
<Button Command="{Binding SetXYZActivatedCommand}" />
I need to execute different commands when the button is pressed and when the button is released a...
I'm using PRISM (and thus the MVVM pattern). I've got a complex DateTime picker view with radio buttons.
The user can pick today, yesterday, a date, a week of a year, etc. I use radio buttons for the different choices.
What's the best way to do that in MVVM?
I really can't think of a clean way. I could create lots of custom behaviors ...
Hi.
Last time I started to implement a Model View ViewModel to work easily with WPF.
I have to say, that it's elegant, but there's one thing I have to remark.
I noticed a performance issue when working with MVVM.
Wrapping the original object into an "Viewable" object can be expensive in case of many items.
I recently had a ListView wit...
Currently my model has ten properties which for our purposes here I'll call AnnualizedRate1, AnnualizedRate2, ..., AnnualizedRate10 which are revealed to views in the view model via ten properties Rate1, Rate2, ..., Rate10. One of my views shows these values in a DataGrid. This is awfully repetitious and a pain to adapt to changing requi...
In my M-V-VM application I have to show the user's avatar. The image is provided in a property of type ImageSource the ViewModel object. So that's what I have currently:
<Image Source="{Binding Path=UserAvatar}"/>
However, some users may not have an avatar configured, so UserAvatar is null. In that case I want to show a default avatar...
i want to split my views project into sereveral modules.
i wanna have a main project that willl have ref to all modules and this main project will generate the view from the modules.
my question is how can i bind all the styles from the application to the other modules?
will it automatically recognize them?
and how will the view model...
It is easy enough to create a command from my OnLoaded() event
handler code, but how do I call it from the View?
<window Loaded="onLoaded"> doesn't cut the cake anymore since
it calls code in the xaml.cs. How would I create an ICommand
equivalent?
...
I've a DataForm which I have set the Visibility of certain DataFields to be Collapsed, and when the user selects an option from a ComboBox, certain DataFields should be made visible again.
Basically (in rough pseudocode).
OnComboBoxChange =
if this.index = 1 then
DataForm.Fields[1].Visibility = Visible
else
Dat...
I am using the MVVM pattern to develop a WPF application.
The app loads a captcha image from the server, and assigns it
to an Image on the WPF form when ready. I am using a
BackgroundWorker to do the threading for me, as follows:
When the Window is being loaded, the following is called:
BackgroundWorker _bgWorker = new BackgroundWork...
I need all children of a view to know a piece of contextual information (the person they need to show). I also need the approach to be compatible with MVVM. I tried to do this with RegionContext in my Prism application. Here's my approach and problems:
I have a TabControl that I use View Injection to populate with views so that I can...
I am trying to access a List on a view model from a background worker, but am getting errors because I am going cross thread...
This is the problem method on the viewmodel: (I am getting the exception the first line in the function (SMMainWindow window ...))
public static MainWindowViewModel GetMainWindowViewModel() {
SMMai...
I'm just beginning to explore the M-V-VM design pattern while redeveloping an application and I'm running across a consistent theme where I have collections that I need my ViewModel to expose to the View which contain items which are to be selected by the user. Please note that when I say "selected" what I mean is that they are chosen in...
What is the typical pattern for displaying an "unavailable" value when databinding in WPF?
For example I am using MVVM, and TextBlocks in my view are bound to my viewmodel's properties, some of which are ints. There are times when I want to temporarily display two dashes ("--") in my view rather than the property value.
I could change ...