Lost The binding MVVM silverlight 5

27 views Asked by At

When I was making an adjustment to a project, I run the application and find that 2 comboboxes are not binded

        <ComboBox x:Name="ComboAgente" HorizontalAlignment="Left" VerticalAlignment="Center"
              Height="23" Grid.Row="2" 
              Grid.Column="2" 
              Margin="10,0,0,0" 
              MinWidth="200"
              IsEnabled="{Binding Path=ModoLectura, Converter={StaticResource NotOperatorValueConverter}}" 
              ItemsSource="{Binding Path=Transmisores}" DisplayMemberPath="NombreAgenteConcepto" 
              SelectedItem="{Binding Path=AgenteSeleccionado,Mode=TwoWay, ValidatesOnNotifyDataErrors=True}" Width="226" />

in the view models prop...

        public List<TransmisorNacionalTO> Transmisores
    {
        get
        {
            return transmisorescargados;
        }
        set
        {
            if (transmisorescargados != value)
            {
                transmisorescargados = value;
                this.RaisePropertyChanged(() => this.Transmisores);
            }
        }
    }

    public TransmisorNacionalTO AgenteSeleccionado
    {
        get
        {
            return agenteseleccionado;
        }
        set
        {
            agenteseleccionado = value;
            this.RaisePropertyChanged(() => this.AgenteSeleccionado);
        }
    }

Combobox #2

<ComboBox x:Name="ComboConvocatoria" HorizontalAlignment="Left" VerticalAlignment="Center" Height="23" Grid.Row="5" Grid.Column="2" 
              Margin="10,0,0,0" MinWidth="200" 
              IsEnabled="{Binding Path=ModoLectura, Converter={StaticResource NotOperatorValueConverter}}" 
              ItemsSource="{Binding Path=Convocatorias}" DisplayMemberPath="Nombre" 
              SelectedItem="{Binding Path=ConvocatoriaSeleccionada,Mode=TwoWay, ValidatesOnNotifyDataErrors=True}" Width="225" />

propieties

    public List<ConvocatoriaTO> Convocatorias
    {
        get
        {
            return convocatorias;
        }
        set
        {
            if (convocatorias != value)
            {
                convocatorias = value;
                this.RaisePropertyChanged(() => this.Convocatorias);
            }
        }
    }


    public ConvocatoriaTO ConvocatoriaSeleccionada
    {
        get
        {
            return convocatoriaSeleccionada;
        }
        set
        {
            convocatoriaSeleccionada = value;
            this.RaisePropertyChanged(() => this.ConvocatoriaSeleccionada);
        }
    }

There are 2 properties defined in the ViewModel, for each comboboxes first one; Transmisores which is a List and the AgenteSeleccionado property which is a object of TransmisorNacionalTO

The second one is the propriety for ConvocatoriaSeleccionada is a Object, and Convocatorias is the list

I don't think I deleted any piece of code!

0

There are 0 answers