<telerik:RadGridView Margin="5,5,5,5" IsReadOnly="True" AutoGenerateColumns="False" ColumnsWidthMode="Fill" ShowColumnHeaders="True" ShowGroupPanel="True" ItemsSource="{Binding Path=AssetAnalysers}"> |
<telerik:RadGridView.Columns> |
<telerik:GridViewDataColumn x:Name="AlertTypeColumn" HeaderText="Type" UniqueName="Analyser.Name" Width="100"/> |
<telerik:GridViewDataColumn x:Name="AlertNameColumn" HeaderText="Name" UniqueName="AnalysedObjectId"/> |
<telerik:GridViewDataColumn x:Name="AlertLevelColumn" HeaderText="Level" UniqueName="Level" Width="100"/> |
<telerik:GridViewDataColumn x:Name="AlertMessageColumn" HeaderText="Message" UniqueName="Message"/> |
</telerik:RadGridView.Columns> |
</telerik:RadGridView> |
<telerik:RadGridView Margin="5,5,5,5" IsReadOnly="True" AutoGenerateColumns="False" ColumnsWidthMode="Fill" ShowColumnHeaders="True" ShowGroupPanel="True" ItemsSource="{Binding Path=AssetAnalysers, IsAsync=true}"> |
<telerik:RadGridView.Columns> |
<telerik:GridViewDataColumn x:Name="AlertTypeColumn" HeaderText="Type" UniqueName="Analyser.Name" Width="100"/> |
<telerik:GridViewDataColumn x:Name="AlertNameColumn" HeaderText="Name" UniqueName="AnalysedObjectId"/> |
<telerik:GridViewDataColumn x:Name="AlertLevelColumn" HeaderText="Level" UniqueName="Level" Width="100"/> |
<telerik:GridViewDataColumn x:Name="AlertMessageColumn" HeaderText="Message" UniqueName="Message"/> |
</telerik:RadGridView.Columns> |
</telerik:RadGridView> |
I have a WPF application that uses the Rad Controls for WPF. On one of the windows, there is a RadDateTimePicker:
<
telerik:RadDateTimePicker
FontSize
=
"{x:Static res:Car.Common_DataEntryFontSize}"
FontWeight
=
"Bold"
Grid.Column
=
"1"
Grid.Row
=
"2"
Height
=
"35"
Margin
=
"5,5,30,5"
Name
=
"BeginDatePicker"
SelectedValue
=
"{Binding Converter={StaticResource DateConverterForPicker}, Mode=TwoWay, Path=LocalBeginDate, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"
SelectionChanged
=
"BeginDatePicker_SelectionChanged"
TabIndex
=
"4"
Validation.ErrorTemplate
=
"{StaticResource InputErrorTemplate}"
VerticalAlignment
=
"Center"
Visibility
=
"{Binding Path=CanModify, Converter={StaticResource BoolToVisibility}}"
/>
string extension = Path.GetExtension(FilePath).ToLower();
Stream stream = File.OpenRead(FilePath);
IImageFormatProvider formatProvider = ImageFormatProviderManager.GetFormatProviderByExtension(extension);
if (formatProvider != null)
{
ImagePath = formatProvider.Import(stream);
}
stream.Close();
XAML:
<
telerik:RadImageEditorUI
x:Name
=
"ImageEditorUi"
Image
=
"{Binding ImagePath}"
Style
=
"{DynamicResource ImageEditorStyle1}"
>
Is binding working for this control? If so, please provide a MVVM example because the documentaiton for this has no binding examples.
<telerik:RadMaskedCurrencyInput Grid.Row="5" Grid.Column="3" Value="{ Binding BgsStepBase, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" Style="{ StaticResource StandardRadMaskedCurrencyInput}" Validation.ErrorTemplate="{ StaticResource RadMaskedCurrencyInputErrorTemplate}" IsClearButtonVisible="True" IsReadOnly="{Binding IsBgsFieldEnabled, Converter={StaticResource NotConverter}}" FormatString="n0" />
<
ResourceDictionary.MergedDictionaries
>
<
ResourceDictionary
Source
=
"/Telerik.Windows.Themes.Windows7;component/Themes/Telerik.Windows.Controls.xaml"
/>
<
ResourceDictionary
Source
=
"/Telerik.Windows.Themes.Windows7;component/Themes/System.Windows.xaml"
/>
<
ResourceDictionary
Source
=
"/Telerik.Windows.Themes.Windows7;component/Themes/Telerik.Windows.Controls.Input.xaml"
/>
<
ResourceDictionary
Source
=
"/Telerik.Windows.Themes.Windows7;component/Themes/Telerik.Windows.Controls.Navigation.xaml"
/>
<
ResourceDictionary
Source
=
"/Telerik.Windows.Themes.Windows7;component/Themes/Telerik.Windows.Controls.Chart.xaml"
/>
<
ResourceDictionary
Source
=
"/Telerik.Windows.Themes.Windows7;component/Themes/Telerik.Windows.Controls.Data.xaml"
/>
<
ResourceDictionary
Source
=
"/Telerik.Windows.Themes.Windows7;component/Themes/Telerik.Windows.Controls.GridView.xaml"
/>
<
ResourceDictionary
Source
=
"/Telerik.Windows.Themes.Windows7;component/Themes/Telerik.Windows.Controls.RibbonView.xaml"
/>
<
ResourceDictionary
Source
=
"Resource Dictionaries/MyDictionary.xaml"
/>
</
ResourceDictionary.MergedDictionaries
>
<
ResourceDictionary
Source
=
"/Telerik.Windows.Themes.Windows7;component/Themes/Telerik.Windows.Controls.Navigation.xaml"
/>
How to give positive and negative values ​​set different colors.
ChartView can do it?
<
chart:RadCartesianChart
x:Name
=
"chart1"
Width
=
"1725"
Height
=
"176"
TrackBallLineStyle
=
"{StaticResource trackBallLineStyle}"
Grid.RowSpan
=
"2"
Loaded
=
"chart1_Loaded"
>
<
chart:RadCartesianChart.TrackBallInfoStyle
>
<
Style
TargetType
=
"chartView:TrackBallInfoControl"
>
<
Setter
Property
=
"Template"
>
<
Setter.Value
>
<
ControlTemplate
TargetType
=
"chartView:TrackBallInfoControl"
>
<
StackPanel
Name
=
"panel"
>
</
StackPanel
>
</
ControlTemplate
>
</
Setter.Value
>
</
Setter
>
</
Style
>
</
chart:RadCartesianChart.TrackBallInfoStyle
>
<
chart:RadCartesianChart.Behaviors
>
<
chartView:ChartTrackBallBehavior
ShowIntersectionPoints
=
"False"
/>
</
chart:RadCartesianChart.Behaviors
>
<
chartView:AreaSeries
CategoryBinding
=
"Time"
ValueBinding
=
"Data"
Fill
=
"#FFCC80"
Stroke
=
"#FF9900"
StrokeThickness
=
"2"
ItemsSource
=
"{Binding DemoList}"
Loaded
=
"AreaSeries_Loaded"
>
<
chartView:AreaSeries.TrackBallInfoTemplate
>
<
DataTemplate
>
<
StackPanel
Orientation
=
"Vertical"
Margin
=
"0,0,0,20"
>
<
Border
Background
=
"#666666"
Width
=
"65"
Height
=
"20"
CornerRadius
=
"3"
HorizontalAlignment
=
"Center"
VerticalAlignment
=
"Center"
>
<
TextBlock
Text
=
"{Binding DataPoint.Value}"
FontSize
=
"14"
FontFamily
=
"Segoe UI"
Foreground
=
"White"
HorizontalAlignment
=
"Center"
VerticalAlignment
=
"Center"
/>
</
Border
>
<
Path
HorizontalAlignment
=
"Center"
VerticalAlignment
=
"Center"
Height
=
"6"
Width
=
"14"
Stretch
=
"Fill"
Opacity
=
"1"
Data
=
"M 25,22 C25,22 39,22 39,22 39,22 32,28 32,28 32,28 25,22 25,22 z"
Fill
=
"#666666"
Margin
=
"0,2,0,0"
/>
</
StackPanel
>
</
DataTemplate
>
</
chartView:AreaSeries.TrackBallInfoTemplate
>
</
chartView:AreaSeries
>
<
chart:RadCartesianChart.HorizontalAxis
>
<
chartView:DateTimeContinuousAxis
MajorStepUnit
=
"Month"
MajorStep
=
"3"
LabelFormat
=
"yyyy年MM月dd日"
LabelInterval
=
"1"
FontFamily
=
"Segoe UI"
PlotMode
=
"OnTicks"
/>
</
chart:RadCartesianChart.HorizontalAxis
>
<
chart:RadCartesianChart.VerticalAxis
>
<
chartView:LinearAxis
Minimum
=
"-3000"
MajorStep
=
"1000"
Maximum
=
"3000"
FontFamily
=
"Segoe UI"
MajorTickStyle
=
"{StaticResource tickStyle}"
LabelStyle
=
"{StaticResource yLableStyle}"
>
</
chartView:LinearAxis
>
</
chart:RadCartesianChart.VerticalAxis
>
<
chart:RadCartesianChart.Grid
>
<
chartView:CartesianChartGrid
MajorLinesVisibility
=
"X"
MajorXLineDashArray
=
"7,3"
StripLinesVisibility
=
"Y"
>
<
chartView:CartesianChartGrid.MajorXLineStyle
>
<
Style
TargetType
=
"{x:Type Line}"
>
<
Setter
Property
=
"Stroke"
Value
=
"#CCCCCC"
/>
</
Style
>
</
chartView:CartesianChartGrid.MajorXLineStyle
>
<
chartView:CartesianChartGrid.YStripeBrushes
>
<
SolidColorBrush
Color
=
"Transparent"
/>
<
SolidColorBrush
Color
=
"#EDEDED"
Opacity
=
"0.5"
/>
</
chartView:CartesianChartGrid.YStripeBrushes
>
</
chartView:CartesianChartGrid
>
</
chart:RadCartesianChart.Grid
>
</
chart:RadCartesianChart
>
I cannot get a simple RadCartesianChart to display when setting the style for a CategoricalSeriesDescriptor. I have a simple one window WPF app (I can send the project if you wish). The project has a folder called "Blah" in which the Telerik.Windows.Controls.xaml and Telerik.Windows.Controls.Chart.xaml Windows8 resource dictionaries are located (both with build action of Page). The Telerik binaries that are referenced by the project are the latest noxaml versions.
If I remove the style for the CategoricalSeriesDescriptor.Style, the chart shows as expected. If I add the style, the project will build and run, but, the chart will not draw, and the message "No data to plot" is displayed. The output shows no exceptions.
Also, when I edit the XAML, no errors are displayed in the XAML editor in VS. However, as soon as I build, the XAML editor underlines (in blue) the entire CategoricalSeriesDescriptor element. The tooltip error message for that element is 'The value "Telerik.Windows.Controls.ChartView.CategoricalSeriesDescriptor" is not of type "Telerik.WIndows.Controls.ChartView.ChartSeriesDescriptor" and cannot be used in this generic collection. Parameter name: value'
Further, if I remove the style completely, the XAML editor complains about the properties like ItemsSourcePath and TypePath. But without the style, the project runs and the chart is displayed.
Please help me figure out what I'm doing wrong. Is it something to do with the resource dictionaries & usage of the noxaml assemblies? The rest of the code is basically straight out of the examples & it's driving me crazy :(.
Thanks - Mitch
The XAML for the windows is:
<
Window
x:Class
=
"Chart3.MainWindow"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
Title
=
"MainWindow"
Height
=
"350"
Width
=
"525"
>
<
Window.Resources
>
<
ResourceDictionary
>
<
ResourceDictionary.MergedDictionaries
>
<
ResourceDictionary
Source
=
"pack://application:,,,/Chart3;component/Blah/Telerik.Windows.Controls.xaml"
/>
<
ResourceDictionary
Source
=
"pack://application:,,,/Chart3;component/Blah/Telerik.Windows.Controls.Chart.xaml"
/>
</
ResourceDictionary.MergedDictionaries
>
</
ResourceDictionary
>
</
Window.Resources
>
<
Grid
>
<
telerik:RadCartesianChart
x:Name
=
"chart"
>
<
telerik:RadCartesianChart.HorizontalAxis
>
<
telerik:DateTimeCategoricalAxis
/>
</
telerik:RadCartesianChart.HorizontalAxis
>
<
telerik:RadCartesianChart.VerticalAxis
>
<
telerik:LinearAxis
/>
</
telerik:RadCartesianChart.VerticalAxis
>
<
telerik:RadCartesianChart.SeriesProvider
>
<
telerik:ChartSeriesProvider
Source
=
"{Binding Series}"
>
<
telerik:ChartSeriesProvider.SeriesDescriptors
>
<
telerik:CategoricalSeriesDescriptor
ItemsSourcePath
=
"MyData"
CategoryPath
=
"Category"
ValuePath
=
"Value"
TypePath
=
"SeriesType"
>
<
telerik:CategoricalSeriesDescriptor.Style
>
<
Style
TargetType
=
"{x:Type telerik:LineSeries}"
>
<
Setter
Property
=
"StrokeThickness"
Value
=
"8"
/>
</
Style
>
</
telerik:CategoricalSeriesDescriptor.Style
>
</
telerik:CategoricalSeriesDescriptor
>
</
telerik:ChartSeriesProvider.SeriesDescriptors
>
</
telerik:ChartSeriesProvider
>
</
telerik:RadCartesianChart.SeriesProvider
>
</
telerik:RadCartesianChart
>
</
Grid
>
</
Window
>
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;
using
Telerik.Charting;
using
Telerik.Windows.Controls.ChartView;
namespace
Chart3
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public
partial
class
MainWindow : Window
{
public
MainWindow()
{
InitializeComponent();
this
.DataContext =
this
;
this
.Series =
new
ObservableCollection<ChartSeries>();
//add some data.
ChartSeries series =
new
ChartSeries();
MyPoint dp =
new
MyPoint();
dp.Value = 10;
dp.Category = DateTime.Now;
series.MyData.Add(dp);
dp =
new
MyPoint();
dp.Value = 40;
dp.Category = DateTime.Now.AddMonths(2);
series.MyData.Add(dp);
dp =
new
MyPoint();
dp.Value = 20;
dp.Category = DateTime.Now.AddMonths(3);
series.MyData.Add(dp);
this
.Series.Add(series);
}
public
ObservableCollection<ChartSeries> Series
{
get
;
set
;
}
}
public
class
ChartSeries
{
public
ChartSeries()
{
this
.MyData =
new
ObservableCollection<MyPoint>();
this
.SeriesType =
typeof
(LineSeries);
}
public
Type SeriesType {
get
;
set
; }
public
ObservableCollection<MyPoint> MyData
{
get
;
set
; }
}
public
class
MyPoint
{
public
object
Category {
get
;
set
; }
public
double
? Value {
get
;
set
; }
}
}