
| <telerik:RadGridView |
| Name="rgv" |
| Grid.Row="1" |
| Margin="10,5,10,5" |
| telerik:StyleManager.Theme="Office_Blue" |
| ShowColumnFooters="True" |
| ShowGroupFooters="True" |
| IsReadOnly="True" |
| AutoGenerateColumns="False" |
| ColumnsWidthMode="Auto" |
| ItemsSource="{Binding Source={StaticResource DataProvider}}"> |
| <telerik:RadGridView.Columns> |
| <telerik:GridViewDataColumn Header="ID" DataMemberPath="ID" > |
| <telerik:GridViewColumn.AggregateFunctions> |
| <telerik:CountFunction Caption="Count:" /> |
| </telerik:GridViewColumn.AggregateFunctions> |
| </telerik:GridViewDataColumn> |
| <telerik:GridViewDataColumn Header="Desc" DataMemberPath="Desc" /> |
| <telerik:GridViewDataColumn Header="Purchase Date" DataMemberPath="Purch_Date" DataFormatString="{}{d}" /> |
| <telerik:GridViewDataColumn Header="Purchase Price" DataMemberPath="Purch_Price" DataFormatString="{}{0:c}" > |
| <telerik:GridViewColumn.AggregateFunctions> |
| <telerik:SumFunction Caption="Sum:" ResultFormatString="{}{0:c}" SourceField="Purch_Price" /> |
| </telerik:GridViewColumn.AggregateFunctions> |
| </telerik:GridViewDataColumn> |
| <telerik:GridViewDataColumn Header="Disposal Date" DataMemberPath="Disp_Date" DataFormatString="{}{d}" /> |
| <telerik:GridViewDataColumn Header="Disposal Price" DataMemberPath="Disp_Price" > |
| <telerik:GridViewColumn.AggregateFunctions> |
| <telerik:SumFunction Caption="Disp Sum:" ResultFormatString="{}{0:c}" SourceField="Disp_Price" /> |
| </telerik:GridViewColumn.AggregateFunctions> |
| </telerik:GridViewDataColumn> |
| <telerik:GridViewDataColumn Header="Type" DataMemberPath="Type" /> |
| <telerik:GridViewDataColumn Header="Tax" DataMemberPath="Tax" /> |
| <telerik:GridViewDataColumn Header="Status" DataMemberPath="Status" /> |
| <telerik:GridViewDataColumn Header="Property Type" DataMemberPath="Property_Type" /> |
| </telerik:RadGridView.Columns> |
| </telerik:RadGridView> |
| <HierarchicalDataTemplate DataType="Category" ItemsSource="{Binding XPath=Category}"> |
| <TextBlock x:Name="tbCategoryName" Text="{Binding XPath=@Name}" MouseRightButtonUp="tbCategoryName_MouseRightButtonUp" |
| MouseDown="tbCategoryName_MouseDown"> |
| </TextBlock> |
| </HierarchicalDataTemplate> |
| <telerik:RadTreeView ItemsSource="{Binding Source={StaticResource CategoriesXML}}" Margin="105,64,0,0" |
| Name="tvOntology" HorizontalAlignment="Left" VerticalAlignment="Top" Width="200" |
| IsEditable="True" IsEnabled="True" IsExpandOnDblClickEnabled="False" |
| IsExpandOnSingleClickEnabled="True"> |
| </telerik:RadTreeView> |
| <Window x:Class="RadGridViewColumnTest.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" |
| xmlns:System="clr-namespace:System;assembly=mscorlib" |
| xmlns:local="clr-namespace:RadGridViewColumnTest" |
| Title="Window1" Height="300" Width="300"> |
| <Grid> |
| <Grid.Resources> |
| <local:StatusConverter x:Key="StatusConverterResource"> |
| </local:StatusConverter> |
| </Grid.Resources> |
| <telerik:RadGridView x:Name="grid" AutoGenerateColumns="False" Grouping="grid_Grouping"> |
| <telerik:RadGridView.Columns> |
| <telerik:GridViewDataColumn HeaderText="Person" DataMemberBinding="{Binding .Name}" DataType="{x:Type System:String}"> |
| </telerik:GridViewDataColumn> |
| <telerik:GridViewDataColumn HeaderText="Age" DataMemberBinding="{Binding .Age}" DataType="{x:Type System:Int32}"/> |
| <telerik:GridViewDataColumn HeaderText="Status" DataMemberBinding="{Binding Path=Status, Converter={StaticResource StatusConverterResource}}" IsSortable="True" DataType="{x:Type System:Int32}" IsGroupable="True"/> |
| </telerik:RadGridView.Columns> |
| </telerik:RadGridView> |
| </Grid> |
| </Window> |
| public class StatusConverter : IValueConverter |
| { |
| #region IValueConverter Members |
| public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) |
| { |
| if ((int)value < 256) |
| { |
| return "< 256"; |
| } |
| else |
| return ">= 256"; |
| } |
| public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) |
| { |
| throw new NotImplementedException(); |
| } |
| #endregion |
| } |
| AddNewRowIfUserDoubleClicksTheLeftPane="true" |
| public class DisplayData |
| { |
| public string Name { get; set; } |
| public ISomeInterfaceType Prop { get; set; } |
| } |
| public interface ISomeInterfaceType |
| { |
| string OtherName { get; } |
| } |
| <telerik:GridViewDataColumn |
| Header="Name" |
| DataMemberBinding="{Binding Path=Name, Mode=OneWay}" |
| Width="2*" |
| IsReadOnly="True"/> |
| <telerik:GridViewDataColumn |
| Header="Other" |
| DataMemberBinding="{Binding Path=Prop.OtherName, Mode=OneWay}" |
| DataType="{x:Type sys:String}" |
| Width="3*" |
| IsReadOnly="True"/> |
| <Window x:Class="NWLinq.Window1" |
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| xmlns:local="clr-namespace:NWLinq" |
| Title="Northwind LINQ" Height="400" Width="575" xmlns:my="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"> |
| <Window.Resources> |
| <ObjectDataProvider x:Key="objectDataProvider" ObjectType="{x:Type local:TestViewModel}" /> |
| </Window.Resources> |
| <Grid DataContext="{Binding Source={StaticResource objectDataProvider}}"> |
| <Grid.ColumnDefinitions> |
| <ColumnDefinition Width="200*" /> |
| <ColumnDefinition Width="300*" /> |
| </Grid.ColumnDefinitions> |
| <Grid.RowDefinitions> |
| <RowDefinition Height="60*" /> |
| <RowDefinition Height="60*" /> |
| <RowDefinition Height="240*" /> |
| </Grid.RowDefinitions> |
| <my:RadGridView |
| Grid.Row="2" |
| Name="radGridView1" |
| Grid.ColumnSpan="2" |
| ColumnsWidthMode="Fill" |
| IsReadOnly="False" |
| SelectedItem="{Binding SelectedItem}" |
| ItemsSource="{Binding CategoryList}" |
| > |
| </my:RadGridView> |
| <TextBlock Margin="91,16,41,10" Name="textBlock1" Text="Name" HorizontalAlignment="Right" VerticalAlignment="Center" /> |
| <TextBlock Margin="91,14,41,8" Name="textBlock2" Grid.Row="1" Text="Description" HorizontalAlignment="Right" VerticalAlignment="Center" /> |
| <TextBox Grid.Column="1" Margin="58,15,64,11" Name="textBox1" Text="{Binding Path=SelectedItem.CategoryName, Mode=TwoWay}" /> |
| <TextBox Margin="58,14,64,8" Name="textBox2" Grid.Column="1" Grid.Row="1" Text="{Binding Path=SelectedItem.Description, Mode=TwoWay}" /> |
| </Grid> |
| </Window> |
| <Window x:Class="NWOA.Window1" |
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| xmlns:my="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView" |
| xmlns:local="clr-namespace:NWOA" |
| Title="Northwind OpenAccess" Height="400" Width="575" > |
| <Window.Resources> |
| <ObjectDataProvider x:Key="objectDataProvider" ObjectType="{x:Type local:TestViewModel}" /> |
| </Window.Resources> |
| <Grid DataContext="{Binding Source={StaticResource objectDataProvider}}"> |
| <Grid.ColumnDefinitions> |
| <ColumnDefinition Width="200*" /> |
| <ColumnDefinition Width="300*" /> |
| </Grid.ColumnDefinitions> |
| <Grid.RowDefinitions> |
| <RowDefinition Height="60*" /> |
| <RowDefinition Height="60*" /> |
| <RowDefinition Height="240*" /> |
| </Grid.RowDefinitions> |
| <my:RadGridView |
| Grid.Row="2" |
| Name="radGridView1" |
| Grid.ColumnSpan="2" |
| ColumnsWidthMode="Fill" |
| IsReadOnly="False" |
| SelectedItem="{Binding SelectedItem}" |
| ItemsSource="{Binding CategoryList}" |
| > |
| </my:RadGridView> |
| <TextBlock Margin="91,16,41,10" Name="textBlock1" Text="Name" HorizontalAlignment="Right" VerticalAlignment="Center" /> |
| <TextBlock Margin="91,14,41,8" Name="textBlock2" Grid.Row="1" Text="Description" HorizontalAlignment="Right" VerticalAlignment="Center" /> |
| <TextBox Grid.Column="1" Margin="58,15,64,11" Name="textBox1" Text="{Binding Path=SelectedItem.CategoryName, Mode=TwoWay}" /> |
| <TextBox Margin="58,14,64,8" Name="textBox2" Grid.Column="1" Grid.Row="1" Text="{Binding Path=SelectedItem.Description, Mode=TwoWay}" /> |
| </Grid> |
| </Window> |
| using System.Windows; |
| namespace NWLinq |
| { |
| public partial class Window1 : Window |
| { |
| public Window1() |
| { |
| InitializeComponent(); |
| } |
| } |
| } |
| ------- |
| using System.Windows; |
| namespace NWOA |
| { |
| public partial class Window1 : Window |
| { |
| public Window1() |
| { |
| InitializeComponent(); |
| } |
| } |
| } |
| using System.Collections.Generic; |
| using System.Linq; |
| namespace NWLinq |
| { |
| public class TestViewModel |
| { |
| NWLinqDataContext dc = new NWLinqDataContext(); |
| public TestViewModel() |
| { |
| SetTable(); |
| } |
| public void SetTable() |
| { |
| var query = |
| from c in dc.Categories select c; |
| CategoryList = query.ToList(); ; |
| } |
| public IList<Category> CategoryList |
| { |
| get; |
| set; |
| } |
| public Category SelectedItem |
| { |
| get; |
| set; |
| } |
| } |
| } |
| using System.Collections.Generic; |
| using NWOpenAccess; |
| using Telerik.OpenAccess; |
| using Telerik.OpenAccess.Query; |
| namespace NWOA |
| { |
| public class TestViewModel |
| { |
| private IObjectScope scope = NWScopeProvider.GetNewObjectScope(); |
| public TestViewModel() |
| { |
| SetTable(); |
| } |
| public void SetTable() |
| { |
| var query = |
| from c in this.scope.Extent<Category>() select c; |
| CategoryList = query.ToList(); ; |
| } |
| public IList<Category> CategoryList |
| { |
| get; |
| set; |
| } |
| public Category SelectedItem |
| { |
| get; |
| set; |
| } |
| } |
| } |
Hi.
I'm using a trial version of RadControls for WPF.
I was looking for a way to dynamically "Zoom" in/out a 2D chart( both the x and y axises).
I tried to change TicksDistance value to achieve this goal, but no use.
I thought a refresh might be needed so I added a Dispatcher.Invoke call, and steel no use.
On the AxisY I tried all the above replacing TicksDistance of AxisX with Step property of AxisY.
No use.
If "zooming" is possible in a 2D (Spline series) what is the correct way achieving it?
Thank you
Uriya
code snippet:
this
.mMyChart.RadChart1.DefaultSeriesDefinition = new SplineSeriesDefinition();
List
<Data> listData = new List<Data>();
for (int i = 0; i < oc.OctaveNotes.Length; i++)
{ listData.Add(
new Data(oc.OctaveNotes[i])); }
this
.mMyChart.RadChart1.ItemsSource = listData;
if
(e.Delta > 0)//wheel up
{
Int32 Step = this.mMyChart.RadChart1.DefaultView.ChartArea.AxisX.TicksDistance;
Step = Step / 4 * 5;
this.mMyChart.RadChart1.DefaultView.ChartArea.AxisX.TicksDistance = Step;
}
else
{
Int32 Step = this.mMyChart.RadChart1.DefaultView.ChartArea.AxisX.TicksDistance;
Step = Step / 5 * 4;
this.mMyChart.RadChart1.DefaultView.ChartArea.AxisX.TicksDistance = Step;
}
this.mMyChart.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Render, mEmptyDelegate);
public class Data
{
private DateTime mX;
public DateTime X
{
get { return mX; }
set { mX = value; }
}
private Double mY;
public Double Y
{
get { return mY; }
set { mY = value; }
}
public
Data(NoteInOctave note)
{
mX = note.NoteDateTime;
Double.TryParse(note.MesuredValue, out mY);
}
}