or

| <Window x:Class="AddColumnIssue.Window1" |
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" |
| Title="Window1" Height="380" Width="701"> |
| <Grid> |
| <Grid.RowDefinitions> |
| <RowDefinition Height="30" /> |
| <RowDefinition Height="*" /> |
| </Grid.RowDefinitions> |
| <Button x:Name="AddColumnButton" Grid.Row="0" Height="23" Width="75" Click="AddColumnButton_Click" >Add Column</Button> |
| <telerik:RadGridView x:Name="ItemsGrid" Grid.Row="1" ItemsSource="{Binding}" AutoGenerateColumns="False" /> |
| </Grid> |
| </Window> |
| public partial class Window1 : Window |
| { |
| public Window1() |
| { |
| InitializeComponent(); |
| AddColumns(); |
| this.DataContext = BuildCustomers(); |
| } |
| private void AddColumnButton_Click(object sender, RoutedEventArgs e) |
| { |
| AddColumn(typeof(string), "Email", 200); |
| RefreshGrid(); |
| } |
| private void AddColumns() |
| { |
| AddColumn(typeof(int), "Number", 100); |
| AddColumn(typeof(string), "Name", 100); |
| } |
| private void AddColumn(Type dataType, string name, int width) |
| { |
| GridViewDataColumn column = new GridViewDataColumn(); |
| column.DataType = dataType; |
| column.HeaderText = name; |
| column.UniqueName = name; |
| column.Width = new GridLength(width); |
| column.IsReadOnly = true; |
| ItemsGrid.Columns.Add(column); |
| } |
| private void RefreshGrid() |
| { |
| ItemsGrid.Rebind(); |
| ItemsGrid.UpdateLayout(); |
| } |
| private static ObservableCollection<Customer> BuildCustomers() |
| { |
| ObservableCollection<Customer> customers = new ObservableCollection<Customer>(); |
| ObservableCollection<Order> orders = new ObservableCollection<Order>(); |
| for (int i = 0; i < 10; i++) |
| orders.Add(new Order { Number = i, Details = "Order" + i }); |
| for (int i = 0; i < 100; i++) |
| customers.Add(new Customer { Email = "Mail" + i, Name = "Name" + i, Number = i, Orders = orders }); |
| return customers; |
| } |
| } |
| Doughnut3DSeriesDefinition definition = new Doughnut3DSeriesDefinition(); | |
| definition.LegendDisplayMode = LegendDisplayMode.DataPointLabel; | |
| radChart1.DefaultSeriesDefinition = definition; | |
| radChart1.DefaultView.ChartLegend.Header = "TEST DATA"; | |
| SeriesMapping seriesMapping = new SeriesMapping(); | |
| ItemMapping itemMapping = new ItemMapping(); | |
| itemMapping.DataPointMember = DataPointMember.YValue; | |
| itemMapping.FieldName = "DoubleData"; | |
| seriesMapping.ItemMappings.Add(itemMapping); | |
| ItemMapping itemMapping2 = new ItemMapping(); | |
| itemMapping2.DataPointMember = DataPointMember.Label; | |
| itemMapping2.FieldName = "StringData"; | |
| seriesMapping.ItemMappings.Add(itemMapping2); | |
| radChart1.SeriesMappings.Add(seriesMapping); | |
| DataTable tt = new DataTable(); | |
| tt = GetDataTable(); | |
| radChart1.ItemsSource = tt; | |
Any help would be much appreciated. Not really sure how the charting works.
Thanks,
Henry
Hello
I wanted to know:
1) When I open the demo project with VS 2008 Professional Edition with SP1, VS crashes.any ideas? I'm using vista sp1, + telerik 2008 q3. I tried running vs with admin but didn't help
2) What's the name of the left control in the demo app(which lists particular control's demos)? It looks like treeview, but I liked it's effects and want to use it in my application. Thanks.