or
public class BusinessObject : INotifyPropertyChanged{ public double Width { get; set; } public double Height { get; set; }}public class PropertyGridWrapper_for_BusinessObject : INotifyPropertyChanged
{private BusinessObject m_BusinessObject = ...;private Size m_Size = ...; [Browsable(false)]public double Width{get { return m_BusinessObject.Width; }set{if (m_BusinessObject.Width != value){if (PreserveAspect)// change Height, as well
else// change Width}}}[Browsable(false)]public double Height { ... similar to Width ... }public Size Size { get { return m_Size; } }[Browsable(false)]public bool PreserveAspect { get; set; }}<DataTemplate x:Key="BusinessObjectSizePropertyGridTemplate"><Grid><Grid.RowDefinitions><RowDefinition /><RowDefinition /></Grid.RowDefinitions><Grid.ColumnDefinitions><ColumnDefinition Width="Auto" /><ColumnDefinition Width="*" /><ColumnDefinition Width="Auto" /></Grid.ColumnDefinitions><TextBlock Grid.Row="0" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center" Text="Height: " /><TextBox Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" Text="{Binding Height}" /><TextBlock Grid.Row="1" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center" Text="Width: " /><TextBox Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Text="{Binding Width}" /><Grid Grid.Row="0" Grid.Column="2" Grid.RowSpan="2" Margin="4"><Grid.RowDefinitions><RowDefinition /><RowDefinition /><RowDefinition /></Grid.RowDefinitions><TextBlock Grid.Row="0" FontFamily="Arial" Text="┐" VerticalAlignment="Bottom" Margin="0,0,0,5" /><CheckBox Grid.Row="1" VerticalAlignment="Center" IsChecked="{Binding PreserveAspect}" /><TextBlock Grid.Row="2" FontFamily="Arial" Text="┘" VerticalAlignment="Top" Margin="0,5,0,0" /></Grid></Grid></DataTemplate><Window xmlns:my="clr-namespace:TelerikGridPrototype" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" x:Class="TelerikGridPrototype.MainWindow" Title="MainWindow" Height="720" Width="1280" WindowStartupLocation="CenterScreen" DataContext="{Binding MainPageViewModel, Source={StaticResource Locator}}"> <telerik:RadBusyIndicator IsBusy="{Binding Busy}"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="660"/> <RowDefinition Height="30"/> </Grid.RowDefinitions> <telerik:RadGridView Name="gridView" ShowGroupPanel="False" IsReadOnly="True" CanUserInsertRows="False" CanUserDeleteRows="False" AreRowDetailsFrozen="True" Grid.Row="0" ItemsSource="{Binding Records}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/> <Button HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Row="1" Content="Load" Name="btnLoad" Width="100"> <i:Interaction.Triggers> <i:EventTrigger EventName="Click"> <ei:CallMethodAction TargetObject="{Binding}" MethodName="LoadDataAsync"/> </i:EventTrigger> </i:Interaction.Triggers> </Button> </Grid> </telerik:RadBusyIndicator></Window>using System;using System.Collections.Generic;using System.Collections.ObjectModel;using System.Linq;using System.Threading.Tasks;using System.Windows;using PhoenixDAL.Models;using SimpleMvvmToolkit;using TelerikGridPrototype.Models;namespace TelerikGridPrototype{ public class MainPageViewModel : ViewModelBase<MainPageViewModel> { public MainPageViewModel() { Records = new ObservableCollection<record>(); } public ObservableCollection<record> Records { get; set; } private bool busy; public bool Busy { get { return busy; } set { busy = value; NotifyPropertyChanged(m => m.Busy); } } public event EventHandler<NotificationEventArgs<Exception>> ErrorNotice; public async void LoadDataAsync() { Busy = true; var q = await Task<List<record>>.Factory.StartNew ( () => DAL.Instance.Phoenix.records.Take(1000).OrderByDescending(a => a.StartTime).ToList() ); foreach (var v in q) { Records.Add(v); } Busy = false; } // Helper method to notify View of an error private void NotifyError(string message, Exception error) { Notify(ErrorNotice, new NotificationEventArgs<Exception>(message, error)); } }}using System;using System.Collections.Generic;using System.ComponentModel.DataAnnotations;namespace PhoenixDAL.Models{ public partial class record { [DisplayAttribute(AutoGenerateField = false)] public long RecordID { get; set; } [DisplayAttribute(Name = "Channel Name")] public string ChannelName { get; set; } [DisplayAttribute(AutoGenerateField = false)] public long StartTime { get; set; } [DisplayAttribute(AutoGenerateField = false)] public long StartEMCRef { get; set; } [DisplayAttribute(AutoGenerateField = false)] public int StartPageIndex { get; set; } [DisplayAttribute(AutoGenerateField = false)] public int StartBlockOffset { get; set; } [DisplayAttribute(AutoGenerateField = false)] public long EndTime { get; set; } [DisplayAttribute(AutoGenerateField = false)] public long EndEMCRef { get; set; } [DisplayAttribute(AutoGenerateField = false)] public int EndPageIndex { get; set; } [DisplayAttribute(AutoGenerateField = false)] public int EndBlockOffset { get; set; } [DisplayAttribute(Name = "Duration")] public long Duration { get; set; } [DisplayAttribute(Name = "Source ID")] public int SourceID { get; set; } [DisplayAttribute(AutoGenerateField = false)] public int SequenceIndex { get; set; } [DisplayAttribute(AutoGenerateField = false)] public Nullable<int> IntegrationID { get; set; } [DisplayAttribute(Name = "Transmission ID")] public string Transmission_ID { get; set; } [DisplayAttribute(Name = "Storage Alias")] public string StorageAlias { get; set; } [DisplayAttribute(Name = "Media Tag")] public Nullable<int> Media_Tag { get; set; } [DisplayAttribute(Name = "Media Description")] public string Media_Description { get; set; } [DisplayAttribute(Name = "Trigger Event")] public string Trigger_Event { get; set; } [DisplayAttribute(Name = "Termination Event")] public string Termination_Event { get; set; } [DisplayAttribute(Name = "Start Time")] public Nullable<System.DateTime> Start_Time { get; set; } [DisplayAttribute(Name = "End Time")] public Nullable<System.DateTime> End_Time { get; set; } [DisplayAttribute(Name = "Total Seconds")] public Nullable<double> Total_Seconds { get; set; } }}public class DataRow{ public int X { get; set; } public int Y { get; set; } public bool Exclude;}ObservableCollection<DataRow> SeriesSource = new ObservableCollection<DataRow>();SeriesMapping series = new SeriesMapping();series.ItemsSource = source;series.ItemMappings.Add(new ItemMapping("X", DataPointMember.XValue));series.ItemMappings.Add(new ItemMapping("Y", DataPointMember.YValue));