Quantcast
Channel: MVVM Light Toolkit
Viewing all 1826 articles
Browse latest View live

Created Unassigned: RelayCommand.CanExecute with null parameter returns false always (since 5.0) [7668]

$
0
0
When I call CanExecute on a RelayCommand<T> with the parameter null, the behavior has changed going from 4.4.32 to 5.0.2.
I have decompiled the assemblies and write the results below. It is clear that the 4.4.32 code accepted null as an argument, whereas the 5.0.2 code does not.

This has broken our code in various places.

```
// Type: GalaSoft.MvvmLight.Command.RelayCommand`1
// Assembly: GalaSoft.MvvmLight, Version=4.4.32.16316, Culture=neutral, PublicKeyToken=6bdae7d54059775e
// MVID: 594A8629-B383-43DD-A41F-7AABF57F1F20
// Assembly location: D:\source\RhinoPlugins\obj\win64\packages\MvvmLightLibs.4.4.32.7\lib\net40\GalaSoft.MvvmLight.dll

public bool CanExecute(object parameter)
{
if (this._canExecute == null)
return true;
if (!this._canExecute.IsStatic && !this._canExecute.IsAlive)
return false;
if (parameter == null && typeof (T).IsValueType)
return this._canExecute.Execute(default (T));
else
return this._canExecute.Execute((T) parameter);
}

// Type: GalaSoft.MvvmLight.Command.RelayCommand`1
// Assembly: GalaSoft.MvvmLight, Version=5.0.2.32240, Culture=neutral, PublicKeyToken=0e453835af4ee6ce
// MVID: 589788DB-9532-473D-82DB-8D64C2AA450B
// Assembly location: D:\source\RhinoPlugins\obj\win64\packages\MvvmLightLibs.5.0.2.0\lib\net40\GalaSoft.MvvmLight.dll

public bool CanExecute(object parameter)
{
if (this._canExecute == null)
return true;
if (this._canExecute.IsStatic || this._canExecute.IsAlive)
{
if (parameter == null && typeof (T).IsValueType)
return this._canExecute.Execute(default (T));
if (parameter is T)
return this._canExecute.Execute((T) parameter);
}
return false;
}
```

Updated Wiki: Home

$
0
0

Project Description

The main purpose of the toolkit is to accelerate the creation and development of MVVM applications in WPF, Silverlight, Windows Store (RT) and for Windows Phone

Get started

More information about the MVVM Light Toolkit can be found on http://www.mvvmlight.net.

Documentation

See http://www.mvvmlight.net/doc

Donate

If you are so enclined, you can donate to MVVM Light Toolkit.
Or, if you prefer, you can pay me a beer next time we're in the same vicinity. Really, it is OK too :)

Latest news:

The latest news about MVVM Light are available from the MVVM feed on my blog at http://blog.galasoft.ch/posts/category/mvvm/.

New Post: SimpleIoC instance delete

$
0
0
I think there has been a new release since the last post here, but it seems the bug is still there. Could you please fix the issue?

New Post: SimpleIoC instance delete

$
0
0
Hi,

The V5 release was a big construction site where I finally took the Portable class library as the main branch. This simplifies the process for me and will allow me to release new versions faster. It might be a little frustrating for the users because I decided to release V5 before I was able to address all the bugs but the situation is much cleaner now and I will address this particular bug next.

Sorry for the delay and be assured that this is important to me.

Cheers
Laurent

Commented Unassigned: RelayCommand.CanExecute with null parameter returns false always (since 5.0) [7668]

$
0
0
When I call CanExecute on a RelayCommand<T> with the parameter null, the behavior has changed going from 4.4.32 to 5.0.2.
I have decompiled the assemblies and write the results below. It is clear that the 4.4.32 code accepted null as an argument, whereas the 5.0.2 code does not.

This has broken our code in various places.

```
// Type: GalaSoft.MvvmLight.Command.RelayCommand`1
// Assembly: GalaSoft.MvvmLight, Version=4.4.32.16316, Culture=neutral, PublicKeyToken=6bdae7d54059775e
// MVID: 594A8629-B383-43DD-A41F-7AABF57F1F20
// Assembly location: D:\source\RhinoPlugins\obj\win64\packages\MvvmLightLibs.4.4.32.7\lib\net40\GalaSoft.MvvmLight.dll

public bool CanExecute(object parameter)
{
if (this._canExecute == null)
return true;
if (!this._canExecute.IsStatic && !this._canExecute.IsAlive)
return false;
if (parameter == null && typeof (T).IsValueType)
return this._canExecute.Execute(default (T));
else
return this._canExecute.Execute((T) parameter);
}

// Type: GalaSoft.MvvmLight.Command.RelayCommand`1
// Assembly: GalaSoft.MvvmLight, Version=5.0.2.32240, Culture=neutral, PublicKeyToken=0e453835af4ee6ce
// MVID: 589788DB-9532-473D-82DB-8D64C2AA450B
// Assembly location: D:\source\RhinoPlugins\obj\win64\packages\MvvmLightLibs.5.0.2.0\lib\net40\GalaSoft.MvvmLight.dll

public bool CanExecute(object parameter)
{
if (this._canExecute == null)
return true;
if (this._canExecute.IsStatic || this._canExecute.IsAlive)
{
if (parameter == null && typeof (T).IsValueType)
return this._canExecute.Execute(default (T));
if (parameter is T)
return this._canExecute.Execute((T) parameter);
}
return false;
}
```
Comments: Same situation here. CanExecute doesn't raise : ``` <Button Content="Se déconnecter" Command="{Binding LogoutCommand}" /> ``` CanExecute raise : ``` <Button Content="Se déconnecter" Command="{Binding LogoutCommand}" CommandParameter="{Binding ElementName=elt}" /> ```

Commented Unassigned: RelayCommand.CanExecute with null parameter returns false always (since 5.0) [7668]

$
0
0
When I call CanExecute on a RelayCommand<T> with the parameter null, the behavior has changed going from 4.4.32 to 5.0.2.
I have decompiled the assemblies and write the results below. It is clear that the 4.4.32 code accepted null as an argument, whereas the 5.0.2 code does not.

This has broken our code in various places.

```
// Type: GalaSoft.MvvmLight.Command.RelayCommand`1
// Assembly: GalaSoft.MvvmLight, Version=4.4.32.16316, Culture=neutral, PublicKeyToken=6bdae7d54059775e
// MVID: 594A8629-B383-43DD-A41F-7AABF57F1F20
// Assembly location: D:\source\RhinoPlugins\obj\win64\packages\MvvmLightLibs.4.4.32.7\lib\net40\GalaSoft.MvvmLight.dll

public bool CanExecute(object parameter)
{
if (this._canExecute == null)
return true;
if (!this._canExecute.IsStatic && !this._canExecute.IsAlive)
return false;
if (parameter == null && typeof (T).IsValueType)
return this._canExecute.Execute(default (T));
else
return this._canExecute.Execute((T) parameter);
}

// Type: GalaSoft.MvvmLight.Command.RelayCommand`1
// Assembly: GalaSoft.MvvmLight, Version=5.0.2.32240, Culture=neutral, PublicKeyToken=0e453835af4ee6ce
// MVID: 589788DB-9532-473D-82DB-8D64C2AA450B
// Assembly location: D:\source\RhinoPlugins\obj\win64\packages\MvvmLightLibs.5.0.2.0\lib\net40\GalaSoft.MvvmLight.dll

public bool CanExecute(object parameter)
{
if (this._canExecute == null)
return true;
if (this._canExecute.IsStatic || this._canExecute.IsAlive)
{
if (parameter == null && typeof (T).IsValueType)
return this._canExecute.Execute(default (T));
if (parameter is T)
return this._canExecute.Execute((T) parameter);
}
return false;
}
```
Comments: It would be : ``` public bool CanExecute(object parameter) { if (this._canExecute == null) return true; if (this._canExecute.IsStatic || this._canExecute.IsAlive) { if (parameter == null && typeof (T).IsValueType) return this._canExecute.Execute(default (T)); if (parameter is T || parameter == null) return this._canExecute.Execute((T) parameter); } return false; } ```

Commented Unassigned: RelayCommand.CanExecute with null parameter returns false always (since 5.0) [7668]

$
0
0
When I call CanExecute on a RelayCommand<T> with the parameter null, the behavior has changed going from 4.4.32 to 5.0.2.
I have decompiled the assemblies and write the results below. It is clear that the 4.4.32 code accepted null as an argument, whereas the 5.0.2 code does not.

This has broken our code in various places.

```
// Type: GalaSoft.MvvmLight.Command.RelayCommand`1
// Assembly: GalaSoft.MvvmLight, Version=4.4.32.16316, Culture=neutral, PublicKeyToken=6bdae7d54059775e
// MVID: 594A8629-B383-43DD-A41F-7AABF57F1F20
// Assembly location: D:\source\RhinoPlugins\obj\win64\packages\MvvmLightLibs.4.4.32.7\lib\net40\GalaSoft.MvvmLight.dll

public bool CanExecute(object parameter)
{
if (this._canExecute == null)
return true;
if (!this._canExecute.IsStatic && !this._canExecute.IsAlive)
return false;
if (parameter == null && typeof (T).IsValueType)
return this._canExecute.Execute(default (T));
else
return this._canExecute.Execute((T) parameter);
}

// Type: GalaSoft.MvvmLight.Command.RelayCommand`1
// Assembly: GalaSoft.MvvmLight, Version=5.0.2.32240, Culture=neutral, PublicKeyToken=0e453835af4ee6ce
// MVID: 589788DB-9532-473D-82DB-8D64C2AA450B
// Assembly location: D:\source\RhinoPlugins\obj\win64\packages\MvvmLightLibs.5.0.2.0\lib\net40\GalaSoft.MvvmLight.dll

public bool CanExecute(object parameter)
{
if (this._canExecute == null)
return true;
if (this._canExecute.IsStatic || this._canExecute.IsAlive)
{
if (parameter == null && typeof (T).IsValueType)
return this._canExecute.Execute(default (T));
if (parameter is T)
return this._canExecute.Execute((T) parameter);
}
return false;
}
```
Comments: This bug has been reported by multiple users, apologies for the regression that came in from the PCL branch. Will fix in the next minor release.

Edited Issue: RelayCommand.CanExecute with null parameter returns false always (since 5.0) [7668]

$
0
0
When I call CanExecute on a RelayCommand<T> with the parameter null, the behavior has changed going from 4.4.32 to 5.0.2.
I have decompiled the assemblies and write the results below. It is clear that the 4.4.32 code accepted null as an argument, whereas the 5.0.2 code does not.

This has broken our code in various places.

```
// Type: GalaSoft.MvvmLight.Command.RelayCommand`1
// Assembly: GalaSoft.MvvmLight, Version=4.4.32.16316, Culture=neutral, PublicKeyToken=6bdae7d54059775e
// MVID: 594A8629-B383-43DD-A41F-7AABF57F1F20
// Assembly location: D:\source\RhinoPlugins\obj\win64\packages\MvvmLightLibs.4.4.32.7\lib\net40\GalaSoft.MvvmLight.dll

public bool CanExecute(object parameter)
{
if (this._canExecute == null)
return true;
if (!this._canExecute.IsStatic && !this._canExecute.IsAlive)
return false;
if (parameter == null && typeof (T).IsValueType)
return this._canExecute.Execute(default (T));
else
return this._canExecute.Execute((T) parameter);
}

// Type: GalaSoft.MvvmLight.Command.RelayCommand`1
// Assembly: GalaSoft.MvvmLight, Version=5.0.2.32240, Culture=neutral, PublicKeyToken=0e453835af4ee6ce
// MVID: 589788DB-9532-473D-82DB-8D64C2AA450B
// Assembly location: D:\source\RhinoPlugins\obj\win64\packages\MvvmLightLibs.5.0.2.0\lib\net40\GalaSoft.MvvmLight.dll

public bool CanExecute(object parameter)
{
if (this._canExecute == null)
return true;
if (this._canExecute.IsStatic || this._canExecute.IsAlive)
{
if (parameter == null && typeof (T).IsValueType)
return this._canExecute.Execute(default (T));
if (parameter is T)
return this._canExecute.Execute((T) parameter);
}
return false;
}
```

Edited Issue: Issue with SimpleIoc public void Unregister(TClass instance) [7636]

$
0
0
The descrpition states that the Unregister instance method simply removes the instance and allows SimpleIoc to create a new instance of the class when it is called again. When unregistering, and trying to create a new instance, an exception occurs.

I've looked into the code and have found that during the Unregister procedure, the factory is also removed which prevents SimpleIoc from creating a new instance. After commenting this bit out, it works. Not sure if there are any further issues that could stem from commenting this out though...

Edited Issue: Relay Command CanExecute() not working in WinRT for refence types [7663]

$
0
0
- create a generic command that receives some class
- bind this command to XAML without value for CommandParameter
In previous version CommandParameter without value leads to null value in code. Now command just not executing.
Is think reference types as command parameter should accept NULL.



In PCL version RelayCommandGeneric.cs, public bool CanExecute(object parameter):

```
if (parameter == null
#if NETFX_CORE
&& typeof(T).GetTypeInfo().IsValueType)
#else
&& typeof(T).IsValueType)
#endif

```
This is covering value type check only, no reference type check.

Edited Issue: RaisePropertyChanged issue [7667]

$
0
0
Bonjour,

lorsque je bind une valeur sur une de mes datagrid (de syncfusion), j'obtiens une erreur sur la fonction RaisePropertyChanged et cela empêche l'ouverture de ma Vue. L'erreur indique une erreur de binding avec comme message "Paramètre incorrect". Je n'ai pas aucne autre précision sur l'erreur. Je vous donne l'extrait de code de ma propriété bindée plus bas. Je n'ai aucune idée d'où peut venir l'erreur ayant peu d'information sur celle-ci. Je précise que j'ai mis à jour le toolkit MVVMLight de la version 4.2 à la dernière 5 et également que j'ai mis à jour mes composants syncfusions. Cela marchait très bien avant ces mises à jour.

Cordialement,

Extrait de ma propriété bindée:
```
/// <summary>
/// The <see cref="Commandes" /> property's name.
/// </summary>
public const string CommandesPropertyName = "Commandes";

private ObservableCollection<Commande> _commandes = new ObservableCollection<Commande>();

/// <summary>
/// Sets and gets the Commandes property.
/// Changes to that property's value raise the PropertyChanged event.
/// </summary>
public ObservableCollection<Commande> Commandes
{
get
{
return _commandes;
}

set
{
if (_commandes == value)
{
return;
}

_commandes = value;
RaisePropertyChanged(CommandesPropertyName);
}
}
```

Closed Unassigned: commands not refreshing the ui [7665]

$
0
0
hi,

i would like to suggest you to look a this issue linked to the usage of mvvm light

https://fluent.codeplex.com/workitem/22520

Please that a look at it

Edited Issue: commands not refreshing the ui [7665]

$
0
0
hi,

i would like to suggest you to look a this issue linked to the usage of mvvm light

https://fluent.codeplex.com/workitem/22520

Please that a look at it

Closed Unassigned: no use of System.Runtime.CompilerServices? [7666]

$
0
0
I added:
protected override void RaisePropertyChanged([CallerMemberName] string propertyName = "")
{
base.RaisePropertyChanged(propertyName);
}
to my first MVVM Light project.

Edited Feature: no use of System.Runtime.CompilerServices? [7666]

$
0
0
I added:
protected override void RaisePropertyChanged([CallerMemberName] string propertyName = "")
{
base.RaisePropertyChanged(propertyName);
}
to my first MVVM Light project.

Commented Feature: Addition Request: UI Validation Handling [7513]

$
0
0
As Karl Shifflet lays out in the his article Input Validation – UI Exceptions & Model Validation Errors (http://karlshifflett.wordpress.com/mvvm/input-validation-ui-exceptions-model-validation-errors/) UI error events need to be handled in order to allow complete validation and prevent a drift between the UI and the underlying Model.

Karl's implementation introduces a View base class, which in my opinion is counter productive as Views may need different base classes, such as UserControls, Windows, etc.

In order to circumnavigate this drawback a collegue and me decided to implement the Functionality for passing the UI error back to the ViewModel. As we use your framework we think that it would make a nice extension (maybe in the Extras namespace). The classes CamelCaseString and UIValidationError are 1:1 copies from Karl's code. The ValidationViewModelBase in the implementation inherits from the MVVMLight ViewModelBase. The class MvvmValidation contains the impementation of the dependency property to register the handler (which is also 1:1 from Karl's code) with the System.Windows.Controls.Validation.ErrorEvent event.

Feel free to modify the code and the namespaces to fit into your environment.
Comments: I was just curious if there is an implementation example for this?

Created Unassigned: Binding on the SelectedItem Property ( Android) [7669]

$
0
0
Recently, we have decided to integrate Mvvm Light in our Android project to take benefits of binding features (actually, we make manual binding through events in our activities). I tried to make a binding on the SelectedItem property of a ListView but i did not succeed. I want to know if the current implementation of the Binding handle that. Can some one show me an example? thanks in advance

New Post: Please add Attribute "CallerMemberName" to RaisePropertyChanged method.

$
0
0
Hi,

is there any way that for the next version you may add the attribute "CallerMemberName" to the signature of the RaisePropertyChanged methode in the ViewModelBase?!?

sig would look like this

protected void RaisePropertyChanged([CallerMemberName]string propertyName = null)
...

That would be a relay gerat deal.

Thx

New Post: Please add Attribute "CallerMemberName" to RaisePropertyChanged method.

$
0
0
Hi,

CallerMemberName is already supported everywhere this attribute exists, as far as I can tell. This has been the case since V4.

Can you be more specific? Where exactly is it missing?

Thanks
Laurent

New Post: [Solved] Please add Attribute "CallerMemberName" to RaisePropertyChanged method.

$
0
0
I quick checked back with a simple test implementation. Your right it seams to already have been added, odd when i check back in the source and the metainformation of the libs it isn't poping up.
So THX for the real quick answer, i will close the discussion.

Btw. never starting an WPF application without your framework ;-)
Viewing all 1826 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>