Open GoogleCodeExporter opened 9 years ago
Issue of Databinding in WPF XAML: <Window x:Class="WpfApplication2.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:vc="clr-namespace:Visifire.Charts;assembly=WPFVisifire.Charts" Title="MainWindow" Height="350" Width="525"> <Grid> <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center" > <DataGrid Width="119" Height="300" x:Name="MyGrid"></DataGrid> <vc:Chart Name="MyChart1" Width="500" Height="300" Padding="10,10" Margin="10,0" AnimatedUpdate="True"> <vc:Chart.Titles> <vc:Title Text="Visifire DataBinding"></vc:Title> </vc:Chart.Titles> <vc:Chart.Series> <vc:DataSeries RenderAs="Column" DataSource="{Binding ItemsSource, ElementName=MyGrid}"> <vc:DataSeries.DataMappings> <vc:DataMapping MemberName="AxisXLabel" Path="Label"></vc:DataMapping> <vc:DataMapping MemberName="YValue" Path="YValue"></vc:DataMapping> </vc:DataSeries.DataMappings> </vc:DataSeries> </vc:Chart.Series> </vc:Chart> </StackPanel> </Grid> </Window> ---------------------- Code behind file: 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; using System.Collections.ObjectModel; namespace WpfApplication2 { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); values.Add(new Value() { Label = "Sony", YValue = 50 }); values.Add(new Value() { Label = "Dell", YValue = 35 }); values.Add(new Value() { Label = "HP", YValue = 27 }); values.Add(new Value() { Label = "HCL", YValue = 17 }); values.Add(new Value() { Label = "Toshiba", YValue = 16 }); MyGrid.ItemsSource = values; } ObservableCollection<Value> values = new ObservableCollection<Value>(); } }
Original issue reported on code.google.com by shoaibi...@gmail.com on 2 Nov 2010 at 8:16
shoaibi...@gmail.com
Original issue reported on code.google.com by
shoaibi...@gmail.com
on 2 Nov 2010 at 8:16