0
votes

I am setting selecteditem manually

public pageXXXX()
        {

            InitializeComponent();

            this.cargaLista();
        }

private void cargaLista()
{
    this.lPickTipo.SelectedItem = this.lPickTipo.Items.OfType<tipos>().First(i => i.tipo == varString);

    // here i load other data 
    //


}

Ok. Runs fine.

But my problem is that selectionchanged event is fire last, not when I set manually the SelectedItem

This is a problem for me. Because I run calc inside "SelectionChanged" event and I need to run calc when I selecteditem because other functions depend on this result

   private void lPickTipo_SelectionChanged(object sender, SelectionChangedEventArgs e)
            {
                try
                {
                    if (this.lPickTipo.SelectedItem != null)
                    {
                        if (lPickTipo.SelectedIndex > -1)
                        {
                            this.calcularTotales();
                        }
                    }
                }
                catch (Exception EXC)
                { // CACTHING }

            }

Why is fire last? How I can solve this?

1
what do you mean by "is fire last"?Matt Lacey
means that is the last event that runs in page before it is displayed .....sorry for my english.aco

1 Answers

0
votes

In that you can't change the order that system level events are raised you'll need to change your logic to account for what the platform does.
As you haven't provided any information on what you're actually basing on the selection or why it requires page (presumably) level events to be fired after the selection is changed it's hard to be more specific.