This question is locked. New answers and comments are not allowed.
I am trying out RAD Silverlight controls and am running into trouble using a CollectionViewSource view as the ItemsSource for a GridView.
The XAML code:
Code in the ViewModel constructor:
ObservableCollection and CollectionViewSource code:
The ObservableCollection is populated elsewhere via RIA Services. LastName and FirstName are public properties of the Agent class.
When bound directly to the ObservableCollection, the GridView displays the data properly. When bound to the CollectionViewSource view, no data appears in the GridView.
The XAML code:
<
telerik:RadGridView
x:Name
=
"agentGrid"
Margin
=
"416,8,192,0"
CanUserFreezeColumns
=
"False"
RowIndicatorVisibility
=
"Collapsed"
ItemsSource
=
"{Binding AgentsCv.View}"
CanUserSelect
=
"True"
IsSynchronizedWithCurrentItem
=
"True"
SelectedItem
=
"{Binding SelectedAgent, Mode=TwoWay}"
ShowGroupPanel
=
"False"
AutoGenerateColumns
=
"False"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
Header
=
"First Name"
DataMemberBinding
=
"{Binding FirstName}"
Width
=
"120"
/>
<
telerik:GridViewDataColumn
Header
=
"Last Name"
DataMemberBinding
=
"{Binding LastName}"
Width
=
"200"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
Code in the ViewModel constructor:
AgentsInternal=new ObservableCollection<
Agent
>();
AgentsCv = new CollectionViewSource {Source = AgentsInternal};
ObservableCollection and CollectionViewSource code:
public CollectionViewSource AgentsCv { get; set; }
public ObservableCollection<
Agent
> AgentsInternal
{
get { return _agentsInternal; }
set
{
if (_agentsInternal == value) return;
_agentsInternal = value;
RaisePropertyChanged(() => AgentsInternal);
}
}
private ObservableCollection<
Agent
> _agentsInternal;
The ObservableCollection is populated elsewhere via RIA Services. LastName and FirstName are public properties of the Agent class.
When bound directly to the ObservableCollection, the GridView displays the data properly. When bound to the CollectionViewSource view, no data appears in the GridView.