or
Q: Can I use Bing Maps (Virtual Earth) within a Windows Forms or WPF Desktop Application?
A: As far as Licensing, you’ll need to contact Microsoft. The “Microsoft Virtual Earth Platform API Terms of Use” doesn’t really cover this specific usage scenario.
Microsoft
doesn’t have a Window Forms or WPF control that you can just drag onto
a Window, but you could access the Web Service from your application or
display the JavaScript Map Control within an embedded WebBrowser
control.
| <Window x:Class="MVVMCommand.MainWindow" |
| x:Name="LayoutRoot" |
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| Title="MainWindow" Height="300" Width="300" |
| xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"> |
| <StackPanel> |
| <Button Content="This one works" |
| CommandParameter="42" |
| Command="{Binding ElementName=LayoutRoot, Path=DataContext.StopCommand}" /> |
| <telerik:RadGridView Name="radGridView1" ItemsSource="abcd"> |
| <telerik:RadGridView.Columns> |
| <telerik:GridViewColumn Header="Start"> |
| <telerik:GridViewColumn.CellTemplate> |
| <DataTemplate> |
| <Button Content="This one does not" |
| CommandParameter="42" |
| Command="{Binding ElementName=LayoutRoot, Path=DataContext.StopCommand}" /> |
| </DataTemplate> |
| </telerik:GridViewColumn.CellTemplate> |
| </telerik:GridViewColumn> |
| </telerik:RadGridView.Columns> |
| </telerik:RadGridView> |
| </StackPanel> |
| </Window> |
| using System; |
| using System.Collections.Generic; |
| using System.Linq; |
| using System.Text; |
| using Microsoft.Practices.Composite.Presentation.Commands; |
| namespace MVVMCommand |
| { |
| public class MVVMCommandViewModel |
| { |
| public DelegateCommand<object> StopCommand { get; set; } |
| public MVVMCommandViewModel(string s) |
| { |
| StopCommand = new DelegateCommand<object>(StopCommand_Execute); |
| } |
| void StopCommand_Execute(object o) |
| { |
| } |
| } |
| } |
| public partial class MainWindow : Window |
| { |
| MVVMCommandViewModel _viewModel; |
| public MainWindow() |
| { |
| InitializeComponent(); |
| _viewModel = new MVVMCommandViewModel("42"); |
| this.DataContext = _viewModel; |
| } |
| } |
| <telerik:GridViewDataColumn Header="UnitPrice" DataMemberBinding="{Binding UnitPrice}" |
| CellTemplateSelector="{StaticResource selector}" DataFormatString="{}{0:c}" /> |
| <telerik:GridViewDataColumn UniqueName="direction" |
| Header="Direction" DataMemberBinding="{Binding Path=eventDirection}"/> |
Hi,
i have tried following thing for Stick chart. Following thing is worling fine now issue:
| public partial class MainPage : UserControl |
| { |
| public MainPage() |
| { |
| InitializeComponent(); |
| InitializeChart(); |
| } |
| private void InitializeChart() |
| { |
| Telerik.Windows.Controls.Charting.StickSeriesDefinition cssd = new StickSeriesDefinition(); |
| cssd.ShowItemToolTips = true; |
| telerikChart.DefaultSeriesDefinition = cssd; |
| telerikChart.ItemsSource = GetStocks(); |
| SeriesMapping sm=new SeriesMapping(); |
| sm.ItemMappings.Add(new ItemMapping("Name", DataPointMember.XCategory)); |
| sm.ItemMappings.Add(new ItemMapping("Open",DataPointMember.Open)); |
| sm.ItemMappings.Add(new ItemMapping("Close", DataPointMember.Close)); |
| sm.ItemMappings.Add(new ItemMapping("Low", DataPointMember.Low)); |
| sm.ItemMappings.Add(new ItemMapping("High", DataPointMember.High)); |
| sm.ItemMappings.Add(new ItemMapping("High", DataPointMember.Tooltip)); |
| telerikChart.SeriesMappings.Add(sm); |
| telerikChart.DefaultSeriesDefinition.ShowItemLabels = true; |
| } |
| private List<Stock> GetStocks() |
| { |
| List<Stock> lstStock = new List<Stock>(); |
| for (int i = 0; i < 1000; i=i+100) |
| { |
| Stock s = new Stock(); |
| s.Name = "Stock" + i; |
| s.Open = i + 100; |
| s.Low = i; |
| Random r = new Random(i); |
| r.NextDouble(); |
| s.Close = r.Next(100,150) + i; |
| s.High = s.Close + i; |
| lstStock.Add(s); |
| } |
| return lstStock; |
| } |
| } |
| public class Stock |
| { |
| public string Name { get; set; } |
| public double Open { get; set; } |
| public double Close { get; set; } |
| public double High { get; set; } |
| public double Low { get; set; } |
| } |
| <telerik:RadTreeView IsDragDropEnabled="True" ItemTemplate="{StaticResource TreeItemTemplate}"> |
| <telerik:RadTreeView.ItemContainerStyle> |
| <Style TargetType="{x:Type telerik:RadTreeViewItem}"> |
| <Setter Property="HorizontalContentAlignment" Value="Stretch"/> |
| </Style> |
| </telerik:RadTreeView.ItemContainerStyle> |
| <telerik:RadTreeView.Items> |
| <Control Name="control1" Tag="Some text for control1" /> |
| <Control Name="control2" Tag="Some text for control2" /> |
| </telerik:RadTreeView.Items> |
| </telerik:RadTreeView> |
| <DataTemplate x:Key="TreeItemTemplate"> |
| <Border BorderThickness="1" BorderBrush="LightGray" Margin="2" CornerRadius="5"> |
| <Grid> |
| <Grid.ColumnDefinitions> |
| <ColumnDefinition Width="Auto"/> |
| <ColumnDefinition Width="*"/> |
| </Grid.ColumnDefinitions> |
| <TextBlock Grid.Column="0" Text="{Binding Name}" Margin="3,0,10,0"/> |
| <GridSplitter Grid.Column="0" Width="1" Background="LightGray" ResizeDirection="Columns"/> |
| <TextBlock Grid.Column="1" Text="{Binding Tag}" Margin="3,0,0,0"/> |
| </Grid> |
| </Border> |
| </DataTemplate> |
| Invalid property or field - '[FieldName]' for type: Object |
| DataFormatString="{}{0:dd/MM/yyyy}" |
| Invalid property or field - '[FieldName from previous]' for type: [Row data type for selected] |
