or
<
telerik:RadGridView
RowIndicatorVisibility
=
"Collapsed"
AllowDrop
=
"False"
AutoGenerateColumns
=
"False"
CanUserDeleteRows
=
"False"
CanUserReorderColumns
=
"False"
GridLinesVisibility
=
"Both"
ShowGroupPanel
=
"False"
ShowColumnHeaders
=
"True"
IsFilteringAllowed
=
"False"
CanUserFreezeColumns
=
"False"
CanUserInsertRows
=
"False"
>...</
telerik:RadGridView
>
namespace
MyUI
{
public
class
MyGridView : Telerik.Windows.Controls.RadGridView
{
public
MyGridView()
:
base
()
{
this
.RowIndicatorVisibility = System.Windows.Visibility.Collapsed;
this
.AllowDrop =
false
;
this
.AutoGenerateColumns =
false
;
this
.CanUserDeleteRows =
false
;
this
.CanUserReorderColumns =
false
;
this
.GridLinesVisibility = Telerik.Windows.Controls.GridView.GridLinesVisibility.Both;
this
.ShowGroupPanel =
false
;
this
.ShowColumnHeaders =
true
;
this
.IsFilteringAllowed =
false
;
this
.CanUserFreezeColumns =
false
;
this
.CanUserInsertRows =
false
;
}
}
}
<
Window
...
xmlns:local
=
"clr-namespace:MyUI;assembly=MyUI"
>
<
local:MyGridView
>...</
local:MyGridView
>
</
Window
>
DiagramExtensions.GetTransformedPoint(diagram,shape.Position);
var parent = ParentFinder.GetAncestor<RadDiagram>(shape);
var transformedPoint = shape.TransformToAncestor(parent)
.Transform(
new
Point(0, 0));
// --- Part of CustomRadGradView.cs (inherits from RadGridView) ---
// Save this RadGridViews layout in background
Task.Run(() =>
{
using
(var manager =
new
CustomPersistenceManager())
{
// this is current RadGridView
manager.SaveLayout(
this
, file);
}
}
}
// --- Part of CustomPersistenceManager.cs (inherits from PersistenceManager) ---
// save layout of any Telerik control
public
bool
SaveLayout(Control control,
string
file =
null
)
{
// Current thread has no access to control -> Invoke required
if
(control.Dispatcher.CheckAccess() ==
false
)
{
bool
result =
false
;
Application.Current.Dispatcher.Invoke(DispatcherPriority.Normal,
new
Action(() => result = DoSaveLayout(control, file)));
return
result;
}
// Current thread has access to control
return
DoSaveLayout(control, file);
}
// save layout to stream
private
bool
DoSaveLayout(Control control,
string
file =
null
)
{
// this lines work without any errors so method is invoked correctly; thread has access to control!
string
name = control.Name;
// returns name of control
control.Name =
"New name"
;
// just for testing
// Next line always throws an InvalidOperationException
using
(var stream = Save(control))
// call save method of Teleriks PersistenceManager class
{
stream.Seek(0, SeekOrigin.Begin);
using
(var reader =
new
StreamReader(stream))
{
string
text = reader.ReadToEnd();
File.WriteAllText(path, text);
}
}
}
01.
public
static
void
ZoomInChart(RadCartesianChart chart,
double
absmin,
double
absmax,
double
ordmin,
double
ordmax)
02.
{
03.
if
(chart !=
null
)
04.
{
05.
double
absMaxValue = ((Telerik.Windows.Controls.ChartView.NumericalAxis)(chart.HorizontalAxis)).ActualRange.Maximum;
06.
double
absMinValue = ((Telerik.Windows.Controls.ChartView.NumericalAxis)(chart.HorizontalAxis)).ActualRange.Minimum;
07.
double
absMaxDelta = Math.Abs(absMaxValue - absMinValue);
08.
double
absDelta = Math.Abs(absmax - absmin);
09.
10.
double
abscoef = absDelta == 0 ||
double
.IsNaN(absDelta) ? 1 : absMaxDelta / absDelta;
11.
12.
double
ordMaxValue = ((Telerik.Windows.Controls.ChartView.NumericalAxis)(chart.VerticalAxis)).ActualRange.Maximum;
13.
double
ordMinValue = ((Telerik.Windows.Controls.ChartView.NumericalAxis)(chart.VerticalAxis)).ActualRange.Minimum;
14.
double
ordMaxDelta = Math.Abs(ordMaxValue - ordMinValue);
15.
double
ordDelta = Math.Abs(ordmax - ordmin);
16.
17.
double
ordcoef = ordDelta == 0 ||
double
.IsNaN(ordDelta) ? 1 : ordMaxDelta / ordDelta;
18.
19.
chart.Zoom =
new
Size(abscoef, ordcoef);
20.
21.
double
virtualWidth = chart.PlotAreaClip.Width * chart.Zoom.Width;
22.
23.
double
virtualHeight = chart.PlotAreaClip.Height * chart.Zoom.Height;
24.
25.
// Produit en croix pour trouver la valeur du nouvel origine
26.
double
absVal = (virtualWidth * (absmin - absMinValue)) / absMaxDelta;
27.
28.
double
ordVal = (virtualHeight * (ordmin - ordMinValue)) / ordMaxDelta;
29.
30.
if
(!
double
.IsNaN(absVal) && !
double
.IsNaN(ordVal))
31.
{
32.
chart.PanOffset =
new
Point(-absVal, -ordVal);
33.
}
34.
}
35.
}