Questions tagged [mvvm-light]
The MVVM Light Toolkit is a set of components helping people to get started with the Model - View - ViewModel pattern in Silverlight, WPF, Xamarin, .NET Core and Windows Phone. It is a light and pragmatic framework that contains only the essential components needed.
2,859
questions
1
vote
1
answer
46
views
Preventing null value insertion through a RelayCommand in WPF MVVM?
Good day, I am new to C# and WPF. Currently, I am trying to create a Todo list, but I am having problems with the CanExecuteAddTodoCommand() for my RelayCommand. I used MVVMlight for this and Material ...
0
votes
0
answers
47
views
How to use a parameter with EventToCommand in mvvmlight on WPF
I have the following datagird in my WPF and I can open a new CustomerOperationView from OperationView with EventTrigger as you see. However, I want to open CustomerOperationView with a parameter for ...
0
votes
1
answer
24
views
How to subscribe to Navigated event from the WebBrowser control on a ViewModel? (MVVM)
So basically I'm trying to subscribe to the Navigated event on the WebBrowser control so I can get the source of the WebBrowser, but I have no idea how to subscribe to it from the ViewModel
I have ...
0
votes
0
answers
96
views
Migration from the MVVM Light Toolkit to the Community MVVM Toolkit
I work on the migration of our WPF project that uses the MVVM pattern from the MVVM Light Toolkit to the Community MVVM Toolkit.
But I don't understand how to port some message classes.
public class ...
-1
votes
2
answers
74
views
Showing two copy of dialog wpf mvvm
So I am developing a two-screen application using wpf with mvvm light. I want to mirror them as much as possible. However, I run into problem with the showdialog for windows. Because ShowDialog will ...
0
votes
0
answers
20
views
MVVM light type not found in cache in design mode when using the ViewModel in a UserControl
So I use mvvm light and I already register the ViewModel to the ViewModelLocator. I try to access the ViewModel from the code behind of a UserControl. But when I use that UserControl in another Page, ...
0
votes
2
answers
77
views
RelayCommand not firing from Context Menu item in a user control
In a user control I have context menu for data grid like shown below
<DataGrid.ContextMenu>
<ContextMenu Focusable="False">
<menuItems:ExportMenuItemView ...
0
votes
1
answer
84
views
Command Chaining in UWP
I have a UWP custom control that have a method and I want to call this method in some ViewModel (I use CommunityToolkit.Mvvm framework in our project), after many searches I found similar solution in ...
1
vote
1
answer
153
views
MVVM Messenger Register / Send Message in VB.net
I just need some Help translating from C# to VB.Net in this Case.
I try to learn about MVVM and WPF. I need to communicate between multiple Views. An easy way should be via MvvmLight Messaging.
...
0
votes
0
answers
43
views
Is there a full parity of features between mvvm light and mvvm toolkit?
Thinking about migrating my WPF apps to MVVM Toolkit from MVVM Light as Lauren discontinued work on MVVM Light and before even taking a look at it I thought I'd ask if there is a full feature parity ...
0
votes
1
answer
53
views
RaisePropertyChanged throws AccessViolationException when update data
I was trying to update data through Textbox when click on the button
the AccessViolationException throws out at random everytime I click on the button to execute some funtions
Not just that,while ...
1
vote
1
answer
154
views
DispatcherHelper in Windows Community Toolkit
I am working on upgrading MVVMLight to Windows Community Toolkit and facing issues with DispatcherHelper. I am unable to find any examples which can show me how to upgrade the functionality relating ...
1
vote
2
answers
1k
views
How to replace a registered service with a new one in MVVM?
Trying to migrate from good old MVVM Light to Windows Community Toolkit. How are we supposed to override a registered service, i.e. replace it with another implementation at runtime?
Example
I have ...
0
votes
1
answer
89
views
UWP Change theme in pop ups MVVM Light
public static async Task SetRequestedThemeAsync()
{
foreach (var view in CoreApplication.Views)
{
await view.Dispatcher.RunAsync(CoreDispatcherPriority....
1
vote
3
answers
497
views
C# JsonIgnore to basic class
I have class
public class SettingsExpires : ViewModelBase
{
private int? frequency;
[JsonProperty("frequency")]
public int? Frequency
{
get => frequency;
...
0
votes
2
answers
217
views
GalaSoft MvvmLight not disabling UserControl with RelayCommand
I'm building a simple application using WPF and GalaSoft MvvmLight (5.4.1.1).
Everything works fine, I have a grid, and when a row is selected I enable/disable buttons that have actions assigned.
...
2
votes
2
answers
1k
views
CollectionView, SelectedItems="{Binding SelectedElement, Mode=TwoWay}" Didn't work
I am trying to bind the "SelectedItems" property of my CollectionView between my View and my ViewModel. But the TwoWay didnt work.
I can send information to my View, but i cant send ...
-1
votes
1
answer
222
views
ItemsControl does not update when ObservableCollection changes
I am creating a calendar and I am using MVVM light. When i change the observable Collection the UI is not updated.
My goal is if i click on a button in my ItemsControl the observable Collection ...
0
votes
0
answers
29
views
wpf mvvm light pass some data between vm with lactor
so i have wpf mvvm project and i want to pass data between view models.
i craeate the window the the xaml of the window datacontex binding call to the lactor view model
DataContext="{Binding ...
0
votes
0
answers
108
views
Change DatePickerTextBox value
Hello I changed the value of the DatePicketTextBox :
<DatePicker Grid.Column="3"
Grid.Row="1"
SelectedDate="{Binding Order.DateIn, Mode=TwoWay}"...
0
votes
2
answers
185
views
Need to move caret to end of a textbox when its bound property is updated by the viewmodel
I am struggling to find a good solution to a nagging problem we are experiencing. We have a multiline textbox in a WPF app using MvvmLight to implement the MVVM design pattern. The textbox is bound to ...
0
votes
0
answers
80
views
MVVMLight does not add ViewLocator and ViewModel to my WPF project
Ok, after adding MVVMLight to my WPF application, no viewlocator or viewmodel was added to the project. I added it through nuget.
I also tried MVVMLightLibs but the same results.
Any help on using ...
1
vote
0
answers
71
views
How to implement a ScrollChanged event within a listbox with parameters using MVVM light
Trying to fire a ScrollChanged-Event via MVVM light.
What i tried:
<ListBox UseLayoutRounding ="True" Name ="myListBox" Grid.Row="0" ItemsSource="{Binding ...
2
votes
1
answer
1k
views
.NET Framework 4.7 to .NET 5 Migration with Galasoft MVVMLight Library
We are migrating our WPF application to .NET 5.
Today we faced some problems with Galasoft Library named MVVMLight. We saw that there are no updates for .NET Standard. We cannot use a.e. ...
0
votes
2
answers
778
views
The KeyDown event will not fire, but the exact same code with PreviewMouseLeftButtonDown event will
I am currently working with WPF to create a simple minigame which requires pressing keys. I have done something similar with mouse clicking, yet I am struggling with keys. I have searched for a quite ...
0
votes
0
answers
22
views
Dispatcher and RaiseCanExecuteChanged() blocking [duplicate]
I've been working on setting up a few WPF UserControls to load their external API data async, and it's mostly been going well- the pattern and base classes I made have worked for 99% of the use cases. ...
0
votes
1
answer
127
views
Set SelectedItem in a ComboBox
I'm trying to set the SelectedItem in a ComboBox but without any success.
As you can see in the above screenshot it shows the first record from the Product list.
Here is the XAML :
<ComboBox Grid....
-1
votes
1
answer
1k
views
WPF round button
I'm trying to create a round button which has a border shown when hovering and has an object binded color.
I tried to make this but when thes button's color is other than transparent, I can't click on ...
0
votes
3
answers
163
views
MvvmLight: View not updated when setting properties from within RelayCommand execution
By lack of any response on the developer's GitHub I will repeat my question here.
I hope someone can help me in some way.
This is the first time I am using MvvmLight, so I hope I am not overlooking ...
0
votes
0
answers
46
views
How to instantiate a Service with parameters in MVVM Light ViewModelLocator?
I have been searching for about 3 hours.
I need to know how do I instantiate a Service with parameters that are produced by another service in MVVM Light's ViewModelLocator.
In my ViewModelLocator ...
0
votes
1
answer
209
views
How to hide/unload a CachedImage in xamarin forms
I am still kind of new to Xamarin forms and now I am using the Ffimagloading library to display a gif through my viewmodel's "DisplayImage" property. But after certain conditions are met, I ...
2
votes
1
answer
743
views
EventToCommand cannot be added to TriggerActionCollection
I'm working on a WPF project using MVVM Light and trying to use an EventToCommand, but I get an error message saying:
A value of type 'EventToCommand' cannot be added to a collection or dictionary of ...
0
votes
1
answer
110
views
UWP Install MVVM Light and NuGet
I am working on an UWP Project in Visual Studio 2019 and I wanted to install the MVVM package. The problem is that, as far as I am concerned, since NuGet 3.1 package installations do not allow to ...
1
vote
1
answer
109
views
Create a interface and inject with SimpleIoc
I created a class AppConfig :
public class AppConfig
{
private readonly IConfigurationRoot _configurationRoot;
public AppConfig()
{
var builder = new ConfigurationBuilder()
...
0
votes
1
answer
163
views
Trouble binding buttons in a DataTemplate to a RelayCommand
I have a view that is displaying a dynamic list of buttons (shown as text.) The users will already expect the text to be "selectable". But that is beside the point.
I am trying to bind the ...
0
votes
2
answers
234
views
ViewModelLocator not firing up
I have been reading about MVVM (and MVVM Light) lately, so tried to implement in an application with 2 ViewModels.
When I use the ViewModelLocator in the datacontext the Command binding does not work, ...
-1
votes
3
answers
120
views
MVVM light. A proper way to execute a method when property's value is really changed
This code allows to execute the method when the property is set.
It executes as much times as the property is set.
I would like to know a variant when the method executes only in case when the ...
0
votes
0
answers
185
views
Handling window closing in WPF - MVVM Light
I'm trying to handle the window closing using a solution similar to this, but the handler in my ViewModel is firing on application start, and not when closing.
XAML:
<i:Interaction.Triggers>
...
1
vote
0
answers
62
views
MVVMLight ViewModel folder missing
I am trying to install MVVMLight for my .NET Core application, but after finishing installing the ViewModel folder is not being generated. In the past I've worked with .NET Framework and MVVMLight, ...
0
votes
1
answer
268
views
WPF command binding works only a few times
I have created a UserControl named AnswerUserControl. XAML file looks like this (it's only button):
<UserControl
...>
<Button
DataContext="{Binding Path=ViewModel,
...
0
votes
1
answer
272
views
MVVM Light, Mahapps metro and EventToCommand via EventTrigger from System.Windows.Interactivity
I'm going nuts on this one:
I have an application using both Mahapps.Metro as well as MVVMLight.
Basically most things are ok UNTIL you try to use Interaction.Triggers.
I typically end up with errors ...
0
votes
1
answer
76
views
MVVM light Command binding in childview broken
I can't get command binding to work in a child view to work. Also I want to check if I do the right thing with the way I open child view. I'm stuck on this for a day now and I'm not sure whether it is ...
0
votes
1
answer
262
views
Slider - change value without clicking thumb
I am trying to move slider without clicking on thumb. What i have for now is clicking on slider and moving thumb to that position. What i want to do is while mouse click is still down to be able to ...
1
vote
1
answer
114
views
Where should most of my platform specific code be in MVVM? (Beside View)
I'm Using Uno-Platform with MVVMLight trying to structure my project.
Should I put platform specific code inside ViewModel? or should it mostly be in Utils/Services?
0
votes
1
answer
168
views
How to refresh DataGrid's ItemsSource automatically after changed? [duplicate]
I don't understand why my ItemsSource don't auto change but when the dialog that is holding the DataGrid is called again, it changed.
This is my ViewModel:
public ObservableCollection<Student> ...
2
votes
1
answer
2k
views
Non-Modal Window in WPF
In my WPF application, Need to show a Non-modal window.
I am using MVVM Light framework.
People are suggesting different libraries to do so but is there any suitable control to do that using MVVM ...
1
vote
1
answer
429
views
Separate MVVM command to each class
I am a newbie in the MVVM pattern. After a long time googling, I start with a MVVM command for a button. For better, I am using MVVM Light NuGet package to write code. There are 2 buttons, on click on ...
0
votes
1
answer
43
views
How can I do this custom Select All function to work?
I have two connected classes: the Smartphone and the Model. The Smartphone contains a collection of Model that looks like this:
public class Smartphone
{
public string BrandName { get; set; }
...
1
vote
1
answer
127
views
Universal Windows UI Responsiveness with Async/Await
Please help me understand how to properly await long executing tasks to keep the UI responsive in a Universal Windows application.
In the code below OperateSystem is a model class which inherits ...
0
votes
1
answer
249
views
MVVM view switching - new view data context not populated under after InitializeComponent
I am developing my first WPF app and am trying to stick to an MVVM approach. I am using MVVM Light. Its a simple app, which just displays a list of things called "Merges" and allows the user to ...