I am working on a project that takes some basic controls and some telerik wpf controls, places them on a canvas, and saves these for redisplay later. All of the controls are generated at runtime.
One problem I am having is with some of the relative and scale values on all gauge controls that use the Telerik.Windows.Controls.Gauge.GaugeMeasure for storing values. instead of saving the actual value set on the property (such as 0.15*), when I save the Xaml, I get the text "Telerik.Windows.Controls.Gauge.GaugeMeasure" as the property value.
To reproduce, place the following on a wpf window:
<
Border
Name
=
"meterBorder"
BorderThickness
=
"1"
BorderBrush
=
"Black"
Background
=
"White"
Width
=
"80"
Height
=
"300"
CornerRadius
=
"3"
>
<
telerik:RadVerticalLinearGauge
Padding
=
"5"
Background
=
"Transparent"
BorderThickness
=
"0"
OuterBackground
=
"Transparent"
OuterBorderThickness
=
"0"
>
<
telerik:VerticalLinearScale
Min
=
"0"
Max
=
"1"
RelativeY
=
"0"
RelativeHeight
=
"0.9"
VerticalAlignment
=
"Center"
Fill
=
"#FF787878"
StartWidth
=
"0.015"
EndWidth
=
"0.015"
MajorTickOffset
=
"0.0"
MinorTickOffset
=
"0.0"
MiddleTicks
=
"1"
MinorTicks
=
"2"
MajorTickStep
=
"0.1"
MajorTicks
=
"10"
LabelFormat
=
"{}{0:F2}"
LabelLocation
=
"OverOutside"
MajorTickLocation
=
"Outside"
Margin
=
"10"
FontSize
=
"8"
Foreground
=
"Black"
MajorTickStrokeThickness
=
"1"
MajorTickStroke
=
"Black"
MinorTickStrokeThickness
=
"1"
MinorTickStroke
=
"Black"
>
<
telerik:VerticalLinearScale.Indicators
>
<
telerik:BarIndicator
Name
=
"valueIndicator"
HorizontalAlignment
=
"Left"
Margin
=
"-20,0,0,0"
Value
=
"0.5"
Background
=
"#FF7171FF"
StartWidth
=
"0.2"
EndWidth
=
"0.2"
StrokeThickness
=
"0"
Width
=
"13"
/>
</
telerik:VerticalLinearScale.Indicators
>
<
telerik:VerticalLinearScale.Ranges
>
<
telerik:GaugeRange
x:Name
=
"LowLowIndicator"
Background
=
"Red"
StartWidth
=
"0.05"
EndWidth
=
"0.05"
Min
=
"0"
Max
=
"0.05"
IndicatorBackground
=
"{x:Null}"
/>
<
telerik:GaugeRange
x:Name
=
"LowIndicator"
Background
=
"#FFE8FF00"
StartWidth
=
"0.05"
EndWidth
=
"0.05"
Min
=
"0.05"
Max
=
"0.15"
IndicatorBackground
=
"{x:Null}"
/>
<
telerik:GaugeRange
x:Name
=
"HighIndicator"
Background
=
"#FFE8FF00"
StartWidth
=
"0.05"
EndWidth
=
"0.05"
Min
=
"0.85"
Max
=
"0.95"
IndicatorBackground
=
"{x:Null}"
TickBackground
=
"{x:Null}"
StrokeThickness
=
"0"
/>
<
telerik:GaugeRange
x:Name
=
"HighHighIndicator"
Background
=
"Red"
StartWidth
=
"0.05"
EndWidth
=
"0.05"
Min
=
"0.95"
Max
=
"1"
IndicatorBackground
=
"{x:Null}"
/>
</
telerik:VerticalLinearScale.Ranges
>
</
telerik:VerticalLinearScale
>
</
telerik:RadVerticalLinearGauge
>
</
Border
>
On top of code-behind:
using
System.IO;
using
System.Xml;
using
System.Windows.Markup;
then in window MouseDoubleClick (or some other event) place the following to save the file:
var fileName = @
"c:\temp\tester.xaml"
;
using
(var fs =
new
FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.Read))
using
(var xw =
new
XmlTextWriter(fs, System.Text.Encoding.UTF8))
{
xw.Formatting = Formatting.Indented;
xw.Indentation = 4;
xw.IndentChar =
' '
;
XamlWriter.Save(meterBorder, xw);
}
throughout the saved Xaml, there will be numerous Telerik.Windows.Controls.Gauge.GaugeMeasure where values should be. Is this a bug in the Telerik controls, or is there some way for me to properly save the correct values for the telerik controls?
Thanks
Thanks