<telerik:RadGridView x:Name="radGrid" Margin="5,5,5,5" ItemsSource="{Binding PersonViews}" RowIndicatorVisibility="Collapsed" AutoGenerateColumns="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" FontSize="14">
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" Header="Name" />
<telerik:GridViewDataColumn DataMemberBinding="{Binding Location}" Header="Location"/>
<telerik:GridViewComboBoxColumn ItemsSourceBinding="{Binding Occupation}"
UniqueName="Uniq"
SelectedValueMemberPath="ID"
DisplayMemberPath="Occupation" Header="Occupation"/>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
using
System.ComponentModel;
using
System.Collections.ObjectModel;
namespace
GridComboBindingTest
{
class GridViewModel : INotifyPropertyChanged
{
private ObservableCollection<PersonView> _personViews;
public GridViewModel()
{
PersonViews =
new ObservableCollection<PersonView>();
PersonView gridView = new PersonView();
gridView.Location =
"Chicago";
gridView.Name =
"Fred";
PersonOccupation tc = new PersonOccupation();
tc.ID = 1;
tc.Occupation =
"Programmer";
gridView.Occupation =
new ObservableCollection<PersonOccupation>();
gridView.Occupation.Add(tc);
tc =
new PersonOccupation();
tc.ID = 2;
tc.Occupation =
"Sales";
gridView.Occupation.Add(tc);
tc =
new PersonOccupation();
tc.ID = 3;
tc.Occupation =
"Tech";
gridView.Occupation.Add(tc);
PersonViews.Add(gridView);
gridView =
new PersonView();
gridView.Location =
"NY";
gridView.Name =
"Joe";
tc =
new PersonOccupation();
tc.ID = 1;
tc.Occupation =
"Cook";
gridView.Occupation =
new ObservableCollection<PersonOccupation>();
gridView.Occupation.Add(tc);
tc =
new PersonOccupation();
tc.ID = 2;
tc.Occupation =
"Chef";
gridView.Occupation.Add(tc);
tc =
new PersonOccupation();
tc.ID = 3;
tc.Occupation =
"Tech";
gridView.Occupation.Add(tc);
PersonViews.Add(gridView);
 
 
 
gridView =
new PersonView();
gridView.Location =
"LA";
gridView.Name =
"Sam";
tc =
new PersonOccupation();
tc.ID = 1;
tc.Occupation =
"Tech";
gridView.Occupation =
new ObservableCollection<PersonOccupation>();
gridView.Occupation.Add(tc);
tc =
new PersonOccupation();
tc.ID = 2;
tc.Occupation =
"Student";
gridView.Occupation.Add(tc);
tc =
new PersonOccupation();
tc.ID = 3;
tc.Occupation =
"Writer";
gridView.Occupation.Add(tc);
PersonViews.Add(gridView);
}
 
public ObservableCollection<PersonView> PersonViews
{
get { return _personViews; }
set
{
if (_personViews != value)
{
_personViews =
value;
RaisePropertyChanged(
"GridViews");
}
}
}
public event PropertyChangedEventHandler PropertyChanged;
private void RaisePropertyChanged(string propertyName)
{
// take a copy to prevent thread issues
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null)
{
handler(
this, new PropertyChangedEventArgs(propertyName));
}
}
}
 
public class PersonView : INotifyPropertyChanged
{
private ObservableCollection<PersonOccupation> _occupation;
public string Name
{
get;
set;
}
public string Location
{
get;
set;
}
 
public ObservableCollection<PersonOccupation> Occupation
{
get { return _occupation; }
set
{
if (_occupation != value)
{
_occupation =
value;
RaisePropertyChanged(
"Person");
}
}
}
public event PropertyChangedEventHandler PropertyChanged;
private void RaisePropertyChanged(string propertyName)
{
// take a copy to prevent thread issues
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null)
{
handler(
this, new PropertyChangedEventArgs(propertyName));
}
}
}
public class PersonOccupation : INotifyPropertyChanged
{
private string _occupation;
private int _ID;
public string Occupation
{
get { return _occupation; }
set
{
if (_occupation != value)
{
_occupation =
value;
RaisePropertyChanged(
"Occupation");
}
}
}
public int ID
{
get { return _ID; }
set
{
if (_ID != value)
{
_ID =
value;
RaisePropertyChanged(
"ID");
}
}
}
public event PropertyChangedEventHandler PropertyChanged;
private void RaisePropertyChanged(string propertyName)
{
// take a copy to prevent thread issues
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null)
{
handler(
this, new PropertyChangedEventArgs(propertyName));
}
}
}
}
RadDiagramShape shape=new RadDiagramShape(); shape.Geometry= ShapeFactory.GetShapeGeometry(CommonShapeType.RectangleShape); raddiag.AddShape(shape);
foreach (RadDiagramShape sample in raddiag.Items)
{
sample.Background = newBrush;
}
public partial class PerfPresenter : INotifyPropertyChanged { public static readonly DependencyProperty VisiblePeriodStartProperty = DependencyProperty.Register("VisiblePeriodStart", typeof(DateTime), typeof(PerfPresenter)); public static readonly DependencyProperty VisiblePeriodEndProperty = DependencyProperty.Register("VisiblePeriodEnd", typeof(DateTime), typeof(PerfPresenter)); public DateTime VisiblePeriodStart { get { return (DateTime)GetValue(VisiblePeriodStartProperty); } set { SetValue(VisiblePeriodStartProperty, value); NotifyPropertyChanged(VisiblePeriodStartProperty.Name); } } public DateTime VisiblePeriodEnd { get { return (DateTime)GetValue(VisiblePeriodEndProperty); } set { SetValue(VisiblePeriodEndProperty, value); NotifyPropertyChanged(VisiblePeriodEndProperty.Name); } } public PerfPresenter() { this.DataContext = this; InitializeComponent(); }public event PropertyChangedEventHandler PropertyChanged; private void NotifyPropertyChanged(String info) { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(info)); } }}
<UserControl x:Class="Microsoft.Office.Engineering.PerfPresenter"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Microsoft.Office.Engineering"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid x:Name="PerfGrid" DataContext="{Binding}">
<telerik:RadTimeBar x:Name="radTimeBar" DataContext="{Binding}"
Grid.Column="1" Background="Transparent"
ItemIntervalChanged="RadTimeBar_ItemIntervalChanged"
PeriodStart="{Binding PeriodStart, Mode=OneWay}" PeriodEnd="{Binding PeriodEnd, Mode=OneWay}"
VisiblePeriodStart="{Binding VisiblePeriodStart, Mode=TwoWay}" VisiblePeriodEnd="{Binding VisiblePeriodEnd,Mode=TwoWay}"
Selection="{Binding TimeSelection, Mode=OneWayToSource}" MinSelectionRange="{Binding MinimumSelectionRange, Mode=OneWay}" SelectionChanged="TimeBarSelectionChanged"
MinZoomRange="{Binding ActualMinZoomRange, Mode=OneWayToSource}"
MouseDoubleClick="RadTimeBarMouseDoubleClick"
VisiblePeriodChanged="RadTimeBarVisiblePeriodChanged">
<telerik:RadTimeBar.Margin>
<Thickness Left="0"
Right="{x:Static SystemParameters.VerticalScrollBarWidth}"
Top="0"
Bottom="0"/>
</telerik:RadTimeBar.Margin>
<telerik:RadTimeBar.Intervals>
<telerik:MinuteInterval IntervalSpans="1, 5, 10, 15" />
</telerik:RadTimeBar.Intervals>
<Grid x:Name="radTimeBarGrid">
</Grid>
</telerik:RadTimeBar>
</Grid>
</UserControl>
<telerik:RadTimeBar DataContext="{Binding}" Intervals="{Binding Intervals, Mode=OneWayToSource}"/><tk:RadGridView Name="RoutesGrid" AutoGenerateColumns="False" IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding PagedSource, ElementName=DataPager}" SelectedItem="{Binding SelectedRoute}" tk:StyleManager.Theme="Summer" MouseRightButtonDown="RadGridView_MouseRightButtonDown"> <!--<tk:RadGridView.GroupDescriptors> <tk:ColumnGroupDescriptor Column="{Binding Columns[\Reading Station\], ElementName=RoutesGrid}" /> </tk:RadGridView.GroupDescriptors>--> <tk:RadGridView.Columns> <tk:GridViewDataColumn Header="ID" DataMemberBinding="{Binding ID}" TextAlignment="Center"> </tk:GridViewDataColumn> <tk:GridViewDataColumn Header="Reading Station" DataMemberBinding="{Binding ReadingWorkstation, Converter={StaticResource WorkstationToNameConverter}}" TextAlignment="Center" Width="Auto">