0

I need to load a property when the tab this propertu is in get focus. I tried by creating a collectioview source in the xaml and having itemsource binded to the property

 <CollectionViewSource x:Key="Sequences_View" Source="{Binding Path=Sequences}"/>

 public BindingList<LNE_SEQUENCE> Sequences
 {
    get
    {....}
 }

since i do not have to bind my collection to anything I found out that it is never loaded. how can I perform the loading of my property?

I'm using c# and wpf and I'm in MVVM so I do not know when the tab get focus since the view model doesn't know about the UI.

andrea
  • 1,326
  • 7
  • 31
  • 60
  • Have you set your DataContext? – Bob. Dec 13 '12 at 14:32
  • yes, in fact other properties that are binded to textboxes, combo boxes are correctly loaded. but the collectionviewsource is not binded and not loaded. Maybe I'm using a non correct behaviour and i need to bind the collection in order to be loaded – andrea Dec 13 '12 at 14:37
  • I believe I could answer your question, but it isn't clear what you are trying to do. Where are you trying to retrieve this data? In your View or your ViewModel? Can you tell us more about how you are using the data? – Alan Dec 13 '12 at 15:09
  • well, I'll try... the binding list is loaded from a database via entityframework, since I do not want to load anything from the database until I'm in that precise tab (i have 3 tab inside another tab created dinamically). at the beginning I put the load in the view model constructor (which is the datacontext of the tab) but in this case I load the data before opening the tab and I do not want it. for this reason i add the collectionview source (binded to anything) but the get of the binding list is never called – andrea Dec 13 '12 at 15:18

0 Answers0