| public partial class MainWindow : Window | |
| { | |
| public MainWindow() | |
| { | |
| this.InitializeComponent(); | |
| MainWindowViewModel model = new MainWindowViewModel(); | |
| RadChart1.DefaultView.ChartArea = model.MainChartArea; | |
| RadChart1.DefaultView.ChartLegend.UseAutoGeneratedItems = true; | |
| } | |
| } | |
| public class MainWindowViewModel | |
| { | |
| private ChartArea _area; | |
| public ChartArea MainChartArea | |
| { | |
| get | |
| { | |
| if (_area == null) | |
| _area = CreateChartArea(); | |
| return _area; | |
| } | |
| } | |
| private ChartArea CreateChartArea() | |
| { | |
| ChartArea area = new ChartArea(); | |
| DataSeries ser1 = new DataSeries(); | |
| ser1.Add(new DataPoint(23)); | |
| ser1.Add(new DataPoint(45)); | |
| ser1.Add(new DataPoint(33)); | |
| ser1.Add(new DataPoint(12)); | |
| ser1.Add(new DataPoint(50)); | |
| ser1.LegendLabel = "Series 1 Label"; | |
| area.DataSeries.Add(ser1); | |
| DataSeries ser2 = new DataSeries(); | |
| ser2.Add(new DataPoint(45)); | |
| ser2.Add(new DataPoint(50)); | |
| ser2.Add(new DataPoint(60)); | |
| ser2.Add(new DataPoint(30)); | |
| ser2.Add(new DataPoint(25)); | |
| ser2.LegendLabel = "Series 2 Label"; | |
| area.DataSeries.Add(ser2); | |
| return area; | |
| } | |
| } |
| <Grid x:Name="LayoutRoot"> | |
| <control:RadChart x:Name="RadChart1"> | |
| <control:RadChart.DefaultView> | |
| <chart:ChartDefaultView> | |
| <chart:ChartDefaultView.ChartLegend> | |
| <chart:ChartLegend x:Name="CustomLegend" Header="Legend Header" UseAutoGeneratedItems="True"> | |
| </chart:ChartLegend> | |
| </chart:ChartDefaultView.ChartLegend> | |
| <chart:ChartDefaultView.ChartTitle> | |
| <chart:ChartTitle> | |
| <TextBlock Text="Declarative RadChart"/> | |
| </chart:ChartTitle> | |
| </chart:ChartDefaultView.ChartTitle> | |
| </chart:ChartDefaultView> | |
| </control:RadChart.DefaultView> | |
| </control:RadChart> | |
| </Grid> |

| <HierarchicalDataTemplate x:Key="hdt" ItemsSource="{Binding ClientPublications}"> |
| <TextBlock Text="{Binding Name}"></TextBlock> |
| </HierarchicalDataTemplate> |
| <telerik:RadPanelBar x:Name="reportMenuPanelBar" Grid.Row="1" Margin="1,0,1,1" ItemsSource="{Binding}" ItemTemplate="{StaticResource hdt}" Selected="reportMenuPanelBar_Selected"> |
| </telerik:RadPanelBar> |
| IList<ClientReport> reports = mgr.GetAllClientReports(); |
| reportMenuPanelBar.DataContext = reports; |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
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;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.GridView;
using Telerik.Windows.Data;
namespace TestTelerikQ2
{
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class Window1 : Window
{
public Window1()
{
try
{
InitializeComponent();
GridViewFooterCell g;
GridViewFooterRow footerRow = new GridViewFooterRow();
Telerik.Windows.Data.SumFunction sum = new SumFunction();
sum.Caption = "sum: ";
sum.ResultFormatString = "{}{0:c}";
sum.SourceField = "Number";
Telerik.Windows.Controls.GridViewDataColumn column =
(Telerik.Windows.Controls.GridViewDataColumn)radGridView1.Columns["Number"];
//column.Footer = footerRow;
DataTable dt = new DataTable();
DataView dv;
dt.Columns.Add("Display", typeof(string));
dt.Columns.Add("Number", typeof(int));
dt.Rows.Add("show", 1);
dt.Rows.Add("show", 2);
dt.Rows.Add("hide", 3);
dv = new DataView(dt);
radGridView1.ItemsSource = dv;
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
}
}
<Window x:Class="WpfToTelerikForum.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="333" Width="639" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">
<StackPanel Orientation="Vertical">
<telerik:RadGridView Margin="12,20,-12,-20"
Name="radGridView1"
Loaded="radGridView1_Loaded" />
<Button Margin="8" Height="50" Width="50" Content="ClickMe" Click="Button_Click"/>
</StackPanel>
</Window>
using System;
using System.Data;
using System.Windows;
using System.Windows.Controls;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.GridView;
using Telerik.Windows.Data;
namespace WpfToTelerikForum
{
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
}
private void radGridView1_Loaded(object sender, RoutedEventArgs e)
{
DataTable dt = new DataTable();
DataView dv;
dt.Columns.Add("Display", typeof(string));
dt.Columns.Add("Number", typeof(int));
dt.Rows.Add("show", 1);
dt.Rows.Add("show", 2);
dt.Rows.Add("hide", 3);
dv = new DataView(dt);
dv.RowFilter = "Display = 'show'";
radGridView1.ItemsSource = dv;
}
private void Button_Click(object sender, RoutedEventArgs e)
{
DataTable dt;
DataView dv;
dv = ((DataView)radGridView1.ItemsSource);
dt = dv.Table;
dt.Rows[dt.Rows.Count-1]["Display"] = "show";
radGridView1.Records[radGridView1.Records.Count-1].IsSelected = true;
}
}
}