Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Xaml binding property - count is 0
Message
De
13/09/2011 12:32:30
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Windows Presentation Foundation (WPF)
Titre:
Xaml binding property - count is 0
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP SP2
Application:
Desktop
Divers
Thread ID:
01523442
Message ID:
01523442
Vues:
75
Hi all,

I have a property in a ViewModel class to hold a list of selected items. The binding in xaml works fine in TwoWay mode but if I try to reference the property the count of items is 0 while the binding clearly shows a value greater than 0. What would be the cause of this?

binding
<ctrl:OCSDMultiSelector LabelText ="Route Manager:" x:Name="multiSelectorRouteManager" SelectedItems="{Binding SelectedRouteManagers, Mode=TwoWay}"/>
Property in View Model
public IList SelectedRouteManagers
{
     get
     {
	return _selectedRouteManagers;
     }

     set
     {
	if (_selectedRouteManagers != value)
	{
                           _selectedRouteManagers = value;
                          OnPropertyChanged("SelectedRouteManagers");
	}
     }
}
private IList _selectedRouteManagers = new WFRouteManagerList();
Test shows count at 0 for this property when tested anywhere like below
protected override bool CanExecute()
{
     return View.Scope.Sites.Count > 0
	&& ((ViewWorkflow)View).WorkflowContext.SelectedRouteManagers.Count > 0
	&& ((ViewWorkflow)View).WorkflowContext.SelectedLOBs.Count > 0;
}
Timothy Bryan
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform