or
<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));
<Window x:Class="TelerikPDFViewerTest.MainWindow" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" Title="MainWindow" Height="550" Width="525"> <Window.CommandBindings> <CommandBinding Command="Open" CanExecute="Open_CanExecute" Executed="Open_Executed" /> <CommandBinding Command="Close" CanExecute="Close_CanExecute" Executed="Close_Executed" /> </Window.CommandBindings> <Grid> <telerik:RadPdfViewer Name="pdfViewer" Margin="3,30,3,3" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" /> <telerik:RadButton Name="btnOpen" Content="Open" Margin="3,3,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="72" Command="Open" /> <telerik:RadButton Name="btnClose" Content="Close" Margin="0,3,0,3" VerticalAlignment="Top" HorizontalAlignment="Right" Width="72" Command="Close" /> </Grid></Window>using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Navigation;using System.Windows.Shapes;namespace TelerikPDFViewerTest{ /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { private System.IO.FileStream fs = null; public MainWindow() { InitializeComponent(); } private void Open_CanExecute(object sender, CanExecuteRoutedEventArgs e) { e.CanExecute =(System.IO.File.Exists("benchbook.pdf")); e.Handled = true; } private void Open_Executed(object sender, ExecutedRoutedEventArgs e) { fs = new System.IO.FileStream("benchbook.pdf", System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Delete); pdfViewer.DocumentSource = new Telerik.Windows.Documents.Fixed.PdfDocumentSource(fs); } private void Close_CanExecute(object sender, CanExecuteRoutedEventArgs e) { e.CanExecute = (this.pdfViewer.Document != null); e.Handled = true; } private void Close_Executed(object sender, ExecutedRoutedEventArgs e) { this.fs.Close(); //Get NullReferenceException in both cases //First try to set document source = null this.pdfViewer.DocumentSource = null; //Or try just releasing the document //this.pdfViewer.Document = null; } }}