or
<
Window
x:Class
=
"PointTemplate.MainWindow"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
Title
=
"MainWindow"
Height
=
"350"
Width
=
"525"
>
<
Window.Resources
>
<
ResourceDictionary
>
<
DataTemplate
x:Key
=
"CircleTemplate"
>
<
Ellipse
Width
=
"8"
Height
=
"8"
VerticalAlignment
=
"Center"
Fill
=
"Black"
/>
</
DataTemplate
>
<
DataTemplate
x:Key
=
"XTemplate"
>
<
Path
Stroke
=
"Black"
Data
=
"M -4,-4 L 4,4 M 4,-4 L -4,4"
/>
<!-- This shows the whole X, but X doesn't mark the spot! -->
<!-- <Path Stroke="Black" Data="M 0,0 L 8,8 M 8,0 L 0,8"/> -->
</
DataTemplate
>
</
ResourceDictionary
>
</
Window.Resources
>
<
Grid
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"1*"
/>
<
RowDefinition
Height
=
"1*"
/>
</
Grid.RowDefinitions
>
<
telerik:RadCartesianChart
x:Name
=
"TimeChart"
Grid.Row
=
"0"
>
<
telerik:RadCartesianChart.Grid
>
<
telerik:CartesianChartGrid
MajorLinesVisibility
=
"XY"
/>
</
telerik:RadCartesianChart.Grid
>
<
telerik:RadCartesianChart.HorizontalAxis
>
<
telerik:DateTimeContinuousAxis
LabelFitMode
=
"Rotate"
LabelFormat
=
"MMM-yy"
/>
</
telerik:RadCartesianChart.HorizontalAxis
>
<
telerik:RadCartesianChart.VerticalAxis
>
<
telerik:LinearAxis
/>
</
telerik:RadCartesianChart.VerticalAxis
>
<
telerik:RadCartesianChart.Series
>
<
telerik:BarSeries
PointTemplate
=
"{StaticResource XTemplate}"
ItemsSource
=
"{Binding Data}"
CategoryBinding
=
"Date"
ValueBinding
=
"YValue"
/>
</
telerik:RadCartesianChart.Series
>
</
telerik:RadCartesianChart
>
<
telerik:RadCartesianChart
x:Name
=
"ScatterChart"
Grid.Row
=
"1"
>
<
telerik:RadCartesianChart.Grid
>
<
telerik:CartesianChartGrid
MajorLinesVisibility
=
"XY"
/>
</
telerik:RadCartesianChart.Grid
>
<
telerik:RadCartesianChart.HorizontalAxis
>
<
telerik:LinearAxis
/>
</
telerik:RadCartesianChart.HorizontalAxis
>
<
telerik:RadCartesianChart.VerticalAxis
>
<
telerik:LinearAxis
/>
</
telerik:RadCartesianChart.VerticalAxis
>
<
telerik:RadCartesianChart.Series
>
<
telerik:ScatterPointSeries
PointTemplate
=
"{StaticResource XTemplate}"
ItemsSource
=
"{Binding Data}"
XValueBinding
=
"XValue"
YValueBinding
=
"YValue"
/>
</
telerik:RadCartesianChart.Series
>
</
telerik:RadCartesianChart
>
</
Grid
>
</
Window
>
using
System;
using
System.Windows;
using
System.Collections.ObjectModel;
namespace
PointTemplate
{
public
class
DataPoint
{
public
DateTime Date {
get
;
set
; }
public
double
YValue {
get
;
set
; }
public
double
XValue {
get
;
set
; }
}
public
partial
class
MainWindow : Window
{
public
Collection<DataPoint> Data {
get
;
set
; }
public
MainWindow()
{
InitializeComponent();
Data =
new
Collection<DataPoint>();
Data.Add(
new
DataPoint() { Date =
new
DateTime(2013, 1, 1), XValue = 10, YValue = 20 });
Data.Add(
new
DataPoint() { Date =
new
DateTime(2013, 2, 1), XValue = 20, YValue = 20 });
Data.Add(
new
DataPoint() { Date =
new
DateTime(2013, 3, 1), XValue = 30, YValue = 40 });
Data.Add(
new
DataPoint() { Date =
new
DateTime(2013, 4, 1), XValue = 40, YValue = 35 });
Data.Add(
new
DataPoint() { Date =
new
DateTime(2013, 5, 1), XValue = 50, YValue = 40 });
Data.Add(
new
DataPoint() { Date =
new
DateTime(2013, 6, 1), XValue = 60, YValue = 30 });
Data.Add(
new
DataPoint() { Date =
new
DateTime(2013, 7, 1), XValue = 70, YValue = 50 });
this
.DataContext =
this
;
}
}
}
"An object of the type "TruNest.Client.CustomCommandProvider" cannot be applied to a property that expects the type "Telerik.Windows.Controls.ICommandProvider".
<UserControl.Resources>
<local:CustomCommandProvider x:Key=
"CustomProvider"
/>
</UserControl.Resources>
<telerik:RadDataForm x:Name=
"dataForm"
HorizontalAlignment=
"Stretch"
VerticalAlignment=
"Stretch"
AutoGeneratingField=
"dataForm_AutoGeneratingField"
CommandButtonsVisibility=
"All"
CommandProvider=
"{StaticResource CustomProvider}"
EditEnded=
"dataForm_EditEnded"
IsEnabled=
"{Binding IsEnabled}"
ItemsSource=
"{Binding TableData}"
/>
using
Telerik.Windows.Controls;
using
Telerik.Windows.Controls.Data.DataForm;
namespace
TruNest.Client
{
public
class
CustomCommandProvider : DataFormCommandProvider
{
public
CustomCommandProvider()
:
base
(
null
)
{
}
public
CustomCommandProvider(RadDataForm dataForm)
:
base
(dataForm)
{
this
.DataForm = dataForm;
}
protected
override
void
CommitEdit()
{
bool
? dialogResult =
null
;
RadWindow.Confirm(
new
DialogParameters()
{
Header =
"Confirm"
,
Content =
"Commit all changes?"
,
Closed = (confirmDialog, eventArgs) =>
{
dialogResult = eventArgs.DialogResult;
}
});
if
((
bool
)dialogResult)
{
this
.DataForm.CommitEdit();
}
}
protected
override
void
CancelEdit()
{
bool
? dialogResult =
null
;
RadWindow.Confirm(
new
DialogParameters()
{
Header =
"Confirm"
,
Content =
"Cancel all changes?"
,
Closed = (confirmDialog, eventArgs) =>
{
dialogResult = eventArgs.DialogResult;
}
});
if
((
bool
)dialogResult)
{
this
.DataForm.CancelEdit();
}
}
protected
override
bool
CanDeleteExecute()
{
return
false
;
}
protected
override
bool
CanAddNewExecute()
{
return
false
;
}
}
}
<
telerik:RadGridView
CanUserSelect
=
"False"
RowLoaded
=
"radGridSuccessRows_RowLoaded"
IsFilteringAllowed
=
"True"
ShowGroupPanel
=
"False"
Name
=
"radGridSuccessRows"
AutoGenerateColumns
=
"True"
RowIndicatorVisibility
=
"Collapsed"
AutoGeneratingColumn
=
"OnAutoGeneratingColumn"
ItemsSource
=
"{Model.ValidationDataSet,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
EnableColumnVirtualization
=
"True"
EnableRowVirtualization
=
"True"
SelectionChanged
=
"RadGridSuccessRows_OnSelectionChanged"
DataLoadMode
=
"Asynchronous"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewSelectColumn
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
void
myDG_RowEditEnded(
object
sender, Telerik.Windows.Controls.GridViewRowEditEndedEventArgs e)
{
if
(e.EditAction == Telerik.Windows.Controls.GridView.GridViewEditAction.Commit)
{
editInDatabase(e.NewData);
}
}
void
editInDatabase(
object
o)
{
myType np = (myType)o;
using
(SqlConnection conn =
new
SqlConnection(cString.c_String))
{
//edit row in database
}
}