Quantcast
Channel: Caliburn.Micro: Xaml Made Easy
Viewing all articles
Browse latest Browse all 1760

New Post: Any good way of setting the activateitem when usingmultiple listboxes as the criteria

$
0
0

Hi,

I have a view which has several listboxes and a contentControl called ActiveItem. The listboxes and their items are decoratively created.

the selection changed is handled like this

[Event SelectionChanged] = [Action ChangeActiveItem($this)]

the viewmodel consists of multiple viewmodels, one for each listbox item.

 

the way this is currently handled is something like 

 

publicvoid ChangeActiveItem(ListboxItem selecteditem)
{

   if(selecteditem.Name == "FirstMenuItemText")
      ActivateItem(ViewModelWhichShouldBeActiavted)
 .if (..)
.
.
.
.
.

}

this seems like a rather error prone and bad way of achieving the goal.  One thing i did try was bind the Tag-property of each listbox-item to the child viewmodel which the item should activate. But that doesn't seem to work - the Tag property is null.
Are there any good ways of achieving this?

 


Viewing all articles
Browse latest Browse all 1760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>