GibboK
GibboK

Reputation: 73928

How select a ListBox when app loads?

I have a ListBox which show several images, every image has two status SELECTED and UNSELECTED. Switching from one status to another makes the image change url - the IDEA is like a Radio Buttons

No action when a user click on a SELECTED image. When a user click another UNSELECTED that image will be SELECTED and the previosly one will go in UNSELECTED.

Now in my code in Floors_SelectionChanged I am able to handle this scenario, my problem is when the application start I need PRE-SELECT and image.

I would need to know:

Upvotes: 1

Views: 47

Answers (1)

Kcvin
Kcvin

Reputation: 5163

  1. The proper approach for most WPF applications is MVVM design
  2. Can you set SelectedIndex = 0 when your ListBox's Loaded event is fired? IF you're using x:Name on ListBox, can you call listbx.SelectedIndex = 0 when your custom control's Loaded event is fired?

Upvotes: 3

Related Questions