or
public class FooViewModel : ViewModelBase { private ObservableCollection<Foo> _fooCollection; private Foo _selectedFoo; private ICommand _addCommand; public ObservableCollection<Foo> FooCollection { get { return _fooCollection; } set { _fooCollection = value; OnPropertyChanged("FooCollection"); } } public Foo SelectedFoo { get { return _selectedFoo; } set { _selectedFoo = value; OnPropertyChanged("SelectedFoo"); } } public ICommand AddCommand { get { return _addCommand ?? (_addCommand = new RelayCommand(i=>this.AddCommandMethod())); } } private void AddCommandMethod() { //Add item to collection //Add item to SelectedFoo }<telerik:RadCartesianChart> <telerik:RadCartesianChart.HorizontalAxis> <telerik:DateTimeCategoricalAxis LabelFitMode="None" LabelFormat="H" DateTimeComponent="Hour" /> </telerik:RadCartesianChart.HorizontalAxis> <telerik:RadCartesianChart.VerticalAxis> <telerik:LinearAxis /> </telerik:RadCartesianChart.VerticalAxis> <telerik:LineSeries ItemsSource="{Binding}" CategoryBinding="XValue" ValueBinding="YValue"/> </telerik:RadCartesianChart>public class ChartData { public DateTime XValue { get; set; } public Double YValue { get; set; } }List<ChartData> datas = new List<ChartData>(); for (int i = 0; i < 23; i++) { datas.Add(new ChartData { XValue = DateTime.Today.AddHours(i), YValue = i }); } DataContext = datas;Hi!
I have a simple task to be done! I have to display a chart using <RadChart> (like one in attachment). It is a simple horizontal bar (I guess with two series STOPPED, ACTIVE). public class DLYChartPoint : LPDEntityStatus { #region Private string label; double value; long uniqueId; #endregion // other class structures }
public ObservableCollection<DLYChartPoint> TimeLineChart
<telerik:RadChart x:Name="timeLineChart" ItemsSource="{Binding TimeLineChart, Mode=TwoWay}"> <telerik:RadChart.DefaultView> <telerik:ChartDefaultView> <telerik:ChartDefaultView.ChartLegend> <telerik:ChartLegend Visibility="Collapsed" /> </telerik:ChartDefaultView.ChartLegend> </telerik:ChartDefaultView> </telerik:RadChart.DefaultView> <telerik:RadChart.SeriesMappings> <telerik:SeriesMapping> <telerik:SeriesMapping.SeriesDefinition> <telerik:HorizontalStackedBarSeriesDefinition ></telerik:HorizontalStackedBarSeriesDefinition> </telerik:SeriesMapping.SeriesDefinition> <telerik:SeriesMapping.ItemMappings> <telerik:ItemMapping DataPointMember="Label" FieldName="Value"></telerik:ItemMapping> <telerik:ItemMapping DataPointMember="YValue" FieldName="Value"></telerik:ItemMapping> <telerik:ItemMapping DataPointMember="XCategory" FieldName="Label"/> </telerik:SeriesMapping.ItemMappings> </telerik:SeriesMapping> </telerik:RadChart.SeriesMappings> </telerik:RadChart>
<t:RadToolBar DockPanel.Dock="Top" Margin="0" Width="{Binding ElementName=DockPanelMain, Path=ActualWidth}" IsTabStop="False" GripVisibility="Collapsed" OverflowButtonVisibility="Collapsed"> <t:RadButton> <Image Stretch="None" Source="Images/Image32.png" /> </t:RadButton>
...
</t:RadToolBar>
Object reference not set to an instance of an object. at Telerik.Windows.Controls.InternalWindow.PopupWindowHost.PopupHostManagerBase.GetManager(DependencyObject obj) in c:\TB\135\WPF_Scrum\Release_WPF\Sources\Development\Controls\Navigation\Window\InternalWindow\PopupWindowHost.cs:line 308 at Telerik.Windows.Controls.InternalWindow.SinglePopupWindowHost.GetHostManager() in c:\TB\135\WPF_Scrum\Release_WPF\Sources\Development\Controls\Navigation\Window\InternalWindow\SinglePopupWindowHost.cs:line 22 at Telerik.Windows.Controls.InternalWindow.PopupWindowHost.Open(Boolean isModal) in c:\TB\135\WPF_Scrum\Release_WPF\Sources\Development\Controls\Navigation\Window\InternalWindow\PopupWindowHost.cs:line 77 at Telerik.Windows.Controls.WindowBase.ShowWindow(Boolean isModal) in c:\TB\135\WPF_Scrum\Release_WPF\Sources\Development\Controls\Navigation\Window\WindowBase.cs:line 891 at Telerik.Windows.Controls.Docking.ToolWindow.Open() in c:\TB\135\WPF_Scrum\Release_WPF\Sources\Development\Controls\Docking\Docking\Parts\ToolWindow.cs:line 121 at Telerik.Windows.Controls.RadDocking.OpenInToolWindow(RadSplitContainer container) in c:\TB\135\WPF_Scrum\Release_WPF\Sources\Development\Controls\Docking\Docking\Docking\RadDocking.cs:line 797 at Telerik.Windows.Controls.RadDocking.InitializeSplitContainer(RadSplitContainer container) in c:\TB\135\WPF_Scrum\Release_WPF\Sources\Development\Controls\Docking\Docking\Docking\RadDocking.cs:line 1325 at Telerik.Windows.Controls.RadDocking.OnApplyTemplate() in c:\TB\135\WPF_Scrum\Release_WPF\Sources\Development\Controls\Docking\Docking\Docking\RadDocking.cs:line 180 at System.Windows.FrameworkElement.ApplyTemplate() at Microsoft.Expression.Platform.WPF.WpfViewNodeManager.EnsureElementInDictionary(Object root, ViewNode knownAncestor)