Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Xaml binding property - count is 0
Message
From
13/09/2011 12:32:30
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
 
To
All
General information
Forum:
ASP.NET
Category:
Windows Presentation Foundation (WPF)
Title:
Xaml binding property - count is 0
Environment versions
Environment:
C# 3.0
OS:
Windows XP SP2
Application:
Desktop
Miscellaneous
Thread ID:
01523442
Message ID:
01523442
Views:
76
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
Next
Reply
Map
View

Click here to load this message in the networking platform