The next code is some kind of weird, but I have to modify to get the value of a selection, in the XAML; takes ItemsSource from a property in the view model... XAML
<ComboBox Height="23" VerticalAlignment="Center" Grid.Row="5" Grid.Column="2"
ItemsSource="{Binding Path=ReglaMateABC, ValidatesOnNotifyDataErrors=False}"
SelectedItem="{Binding Path=Contribucion.ReglaMatematicaTexto, Mode=TwoWay, NotifyOnValidationError=True}" />
in MVVM code:
public List<String> ReglaMateABC
{
get
{
List<String> data = new List<string>();
data.Add(ControlesResource.TextoReglaMatematicaAB);
data.Add(ControlesResource.TextoReglaMatematicaC);
data.Add(ControlesResource.TextoReglaMatematicaD);
return data;
}
// this set is added for me
set
{
**SomeVariable** = value;
this.RaisePropertyChanged(() => this.ListTipoPpa);
}
}
the ControlesResource.TextoReglaMatematicaxx is Taken from a resource file.
what type of variable (SomeVariable) should i use?
Prism.ViewModel is being used, and RaisePropertyChanged what it takes to work?
UPDATE this is transfer object class that is binding in the XAML file, in SelectedItem="{Binding Path=Contribucion.ReglaMatematicaTexto ...
public class ContribucionTO
{
/// <summary>
/// Identificador de la Contribución.
/// </summary>
public string ContribucionId { get; set; }
/// <summary>
/// Vigencia de la contribución.
/// </summary>
public VigenciaTO Vigencia { get; set; }
/// <summary>
/// Nombre de la contribución.
/// </summary>
[Required(AllowEmptyStrings = false, ErrorMessageResourceName = "ContribucionTONombreRequerido", ErrorMessageResourceType = typeof(MensajesValidacionResource))]
[StringLength(150, MinimumLength = 0, ErrorMessageResourceName = "ContribucionTONombreLongitud", ErrorMessageResourceType = typeof(MensajesValidacionResource))]
public string Nombre { get; set; }
/// <summary>
/// Descripción de la contribución.
/// </summary>
[Required(AllowEmptyStrings = false, ErrorMessageResourceName = "ContribucionTODescripcionRequerido", ErrorMessageResourceType = typeof(MensajesValidacionResource))]
[StringLength(150, MinimumLength = 0, ErrorMessageResourceName = "ContribucionTODescripcionLongituda", ErrorMessageResourceType = typeof(MensajesValidacionResource))]
public string Descripcion { get; set; }
/// <summary>
/// Valor de la tarifa de la contribución.
/// </summary>
public decimal Tarifa { get; set; }
/// <summary>
/// Indica si la tarifa de la contribución se actualiza o no.
/// </summary>
public bool ActualizaTarifa { get; set; }
/// <summary>
/// Indica si la regla matemática a utilizar es A+B (True) o C (False)
/// </summary>
public bool ReglaMatematica { get; set; }
/// <summary>
/// Indicador base de la contribución.
/// </summary>
public IndicadorTO IndicadorBase { get; set; }
/// <summary>
/// Convocatorias que se excluyen de la distribución de la contribución.
/// </summary>
public List<ConvocatoriaTO> ConvocatoriasExcluidas { get; set; }
}//end ContribucionTO