Note that there are some explanatory texts on larger screens.

plurals
  1. POCombobox SelectedValue "Cannot save value from target back to source"
    text
    copied!<p>I have the following combobox:</p> <pre><code>&lt;Controls:RadComboBox ItemsSource="{Binding UsuariosApp,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" SelectedValue="{Binding SelectedUsuario}" IsEnabled="{Binding ChangeUserEnabled}"/&gt; </code></pre> <p>Viewmodel:</p> <pre><code>public List&lt;UsuarioDetalle&gt; UsuariosApp { get { if (_users == null) { _users = new List&lt;UsuarioDetalle&gt;(); if (AuthenticationController.ChildUserEntities != null) _users.AddRange(AuthenticationController.ChildUserEntities); } return _users; } set { _users = value; OnPropertyChanged(() =&gt; UsuariosApp); } } public object SelectedUsuario { get { if (UsuariosApp != null &amp;&amp; UsuariosApp.Count &gt; 0) { AuthenticationController.CurrentUser = UsuariosApp[0].idUsuario; AuthenticationController.CurrentUserRole = (RolesUsuario)UsuariosApp[0].idStTipoUsuario; _lastUser = UsuariosApp[0]; return UsuariosApp[0]; } return null; } set { if (!((UsuarioDetalle)_lastUser).idUsuario.ToString().Equals(((UsuarioDetalle)value).idUsuario.ToString())) { bool? confirmation = SwitchUserConfirmation(); if (confirmation.HasValue &amp;&amp; confirmation.Value.Equals(false)) { // Alex: cancelar el cambio de valor del combo ChangeUser = _lastUser; } else { ResetWorkspace(value); } } else { ResetWorkspace(value); } } } </code></pre> <p>It works but in the output I have the following error when I change the value of the combobox</p> <blockquote> <p>System.Windows.Data Error: 8 : Cannot save value from target back to source. BindingExpression:Path=SelectedUsuario; DataItem='MainWindowViewModel' (HashCode=26603182); target element is 'RadComboBox' (Name='comboChildUsers'); target property is 'SelectedValue' (type 'Object') TargetInvocationException:'System.Reflection.TargetInvocationException: Se produjo una excepción en el destino de la invocación. ---> System.NullReferenceException: Referencia a objeto no establecida como instancia de un objeto.</p> </blockquote> <p>What could be the reason?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload