Jump to content
emanuelx

listbox

Recommended Posts

emanuelx

boas!

eu tenho um programa em vb.net.

mas queria usar uma listbox mais fixe, em wpf.

eu no vb.net uso estes eventos

Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged

     

    End Sub

    Private Sub ListBox1_SelectedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedValueChanged

     

    End Sub

mas em wpf nao consigo encontra-los.

so encontrei este.

Private Sub ListBox1_SelectionChanged(sender As System.Object, e As System.Windows.Controls.SelectionChangedEventArgs) Handles ListBox1.SelectionChanged

            End Sub

é possivel eu ter aqueles eventos do vb.net no wpf?


com calma e sem stresses

Share this post


Link to post
Share on other sites
sandra.moraisg

Olá boa noite:

Tenta neste site tem muita informação!!!

Espero ter ajudado!!

sandra  Garcia

Share this post


Link to post
Share on other sites
saramgsilva

Eu acho que o SelectionChanged é o evento que precisas e é suficiente.

Se houve uma alteração na seleção da listbox implica que o SelectItem, SelectedValue e o SelectedIndex foram alterados.

Ve o seguinte pedaço de código para obteres os valores de SelectItem, SelectedValue e o SelectedIndex:

private void lbxSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var selectValue = ((ListBox) sender).SelectedValue;
            var selectIndex = ((ListBox) sender).SelectedIndex;
            var selectItem = ((ListBox)sender).SelectedItem;
        }

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.