This question is locked. New answers and comments are not allowed.
Filter drop down is empty when I set ItemsSource from xaml.
Here is simplified sample:
Startup page xaml:
Here is simplified sample:
| public class Item |
| { |
| public string Title |
| { |
| get; |
| set; |
| } |
| } |
| public class AppContext |
| { |
| private static AppContext _instance = new AppContext(); |
| private ObservableCollection<Item> _items = new ObservableCollection<Item>(); |
| public static AppContext Instance |
| { |
| get |
| { |
| return _instance; |
| } |
| } |
| public ObservableCollection<Item> Items |
| { |
| get |
| { |
| _items.Add(new Item() { Title = "New Item" }); |
| return _items; |
| } |
| set |
| { |
| _items = value; |
| } |
| } |
| } |
Startup page xaml:
| <UserControl x:Class="SilverlightApplication1.MainPage" |
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
| xmlns:local="clr-namespace:SilverlightApplication1" |
| xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
| xmlns:grid="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView" |
| mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"> |
| <UserControl.Resources> |
| <local:AppContext x:Key="AppContext"/> |
| </UserControl.Resources> |
| <Grid x:Name="LayoutRoot"> |
| <grid:RadGridView x:Name="radGrid" AutoGenerateColumns="False" ItemsSource="{Binding Items, Source={StaticResource AppContext}}"> |
| <grid:RadGridView.Columns> |
| <grid:GridViewDataColumn Header="Title" DataMemberBinding="{Binding Title}"/> |
| </grid:RadGridView.Columns> |
| </grid:RadGridView> |
| </Grid> |
| </UserControl> |
