Sasa Grebenar
Top achievements
Rank 1
Sasa Grebenar
asked on 18 Nov 2010, 01:28 PM
Dear
How can I define point style when I show esri shape point layer...
Best regards
SASA
How can I define point style when I show esri shape point layer...
Best regards
SASA
1 Answer, 1 is accepted
0
Hello Sasa Grebenar,
There are two ways you can use to define point style.
1. You can re-define the default style of MapPinPoint element.
2. You can specify custom styles to the points using the PreviewReadCompleted event.
Sincerely yours,
Andrey Murzov
the Telerik team
There are two ways you can use to define point style.
1. You can re-define the default style of MapPinPoint element.
<
UserControl
x:Class
=
"ESRIShapePoint.MainPage"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
mc:Ignorable
=
"d"
d:DesignHeight
=
"300"
d:DesignWidth
=
"400"
>
<
UserControl.Resources
>
<
ResourceDictionary
>
<
Style
TargetType
=
"telerik:MapPinPoint"
>
<
Setter
Property
=
"Template"
>
<
Setter.Value
>
<
ControlTemplate
TargetType
=
"telerik:MapPinPoint"
>
<
Border
Background
=
"Transparent"
BorderThickness
=
"1"
Padding
=
"2,2,2,2"
>
<
telerik:MapLayer.HotSpot
>
<
telerik:HotSpot
X
=
"0.5"
Y
=
"0.5"
ElementName
=
"PART_Image"
/>
</
telerik:MapLayer.HotSpot
>
<
Grid
Name
=
"PART_Panel"
>
<
Path
Fill
=
"Brown"
Name
=
"PART_Image"
>
<
Path.Data
>
<
GeometryGroup
>
<
EllipseGeometry
Center
=
"7,7"
RadiusX
=
"3"
RadiusY
=
"3"
/>
<
EllipseGeometry
Center
=
"7,7"
RadiusX
=
"7"
RadiusY
=
"7"
/>
</
GeometryGroup
>
</
Path.Data
>
</
Path
>
</
Grid
>
</
Border
>
</
ControlTemplate
>
</
Setter.Value
>
</
Setter
>
</
Style
>
</
ResourceDictionary
>
</
UserControl.Resources
>
<
Grid
x:Name
=
"LayoutRoot"
Background
=
"White"
>
<
telerik:RadMap
Name
=
"radMap"
Center
=
"40,-100"
ZoomLevel
=
"2"
>
<
telerik:RadMap.Provider
>
<
telerik:OpenStreetMapProvider
/>
</
telerik:RadMap.Provider
>
<
telerik:InformationLayer
Name
=
"informationLayer"
>
<
telerik:InformationLayer.Reader
>
<
telerik:MapShapeReader
Source
=
"/ESRIShapePoint;component/airprtx020"
ExtendedPropertySet
=
"NAME,string FEATURE,string"
ToolTipFormat
=
" {NAME} - {FEATURE}"
/>
</
telerik:InformationLayer.Reader
>
</
telerik:InformationLayer
>
</
telerik:RadMap
>
</
Grid
>
</
UserControl
>
2. You can specify custom styles to the points using the PreviewReadCompleted event.
<
UserControl
x:Class
=
"ESRIShapePoint.MainPage"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
mc:Ignorable
=
"d"
d:DesignHeight
=
"300"
d:DesignWidth
=
"400"
>
<
UserControl.Resources
>
<
ResourceDictionary
>
<
Style
x:Key
=
"SpecialPointStyle"
TargetType
=
"telerik:MapPinPoint"
>
<
Setter
Property
=
"Template"
>
<
Setter.Value
>
<
ControlTemplate
TargetType
=
"telerik:MapPinPoint"
>
<
Border
Background
=
"Transparent"
Padding
=
"2,2,2,2"
>
<
telerik:MapLayer.HotSpot
>
<
telerik:HotSpot
X
=
"0.5"
Y
=
"0.5"
ElementName
=
"PART_Image"
/>
</
telerik:MapLayer.HotSpot
>
<
Grid
Name
=
"PART_Panel"
>
<
Path
Fill
=
"Blue"
Name
=
"PART_Image"
>
<
Path.Data
>
<
GeometryGroup
>
<
EllipseGeometry
RadiusX
=
"12"
RadiusY
=
"12"
/>
</
GeometryGroup
>
</
Path.Data
>
</
Path
>
</
Grid
>
</
Border
>
</
ControlTemplate
>
</
Setter.Value
>
</
Setter
>
</
Style
>
</
ResourceDictionary
>
</
UserControl.Resources
>
<
Grid
x:Name
=
"LayoutRoot"
Background
=
"White"
>
<
telerik:RadMap
Name
=
"radMap"
Center
=
"40,-100"
ZoomLevel
=
"2"
>
<
telerik:RadMap.Provider
>
<
telerik:OpenStreetMapProvider
/>
</
telerik:RadMap.Provider
>
<
telerik:InformationLayer
Name
=
"informationLayer"
>
<
telerik:InformationLayer.Reader
>
<
telerik:MapShapeReader
Source
=
"/ESRIShapePoint;component/airprtx020"
ExtendedPropertySet
=
"NAME,string FEATURE,string"
ToolTipFormat
=
" {NAME} - {FEATURE}"
PreviewReadCompleted
=
"MapShapeReader_PreviewReadCompleted"
/>
</
telerik:InformationLayer.Reader
>
</
telerik:InformationLayer
>
</
telerik:RadMap
>
</
Grid
>
</
UserControl
>
using
System.Windows;
using
System.Windows.Controls;
using
Telerik.Windows.Controls.Map;
namespace
ESRIShapePoint
{
public
partial
class
MainPage : UserControl
{
public
MainPage()
{
InitializeComponent();
}
private
void
MapShapeReader_PreviewReadCompleted(
object
sender, PreviewReadShapesCompletedEventArgs eventArgs)
{
foreach
(FrameworkElement element
in
eventArgs.Items)
{
element.Style = (Style)
this
.Resources[
"SpecialPointStyle"
];
}
}
}
}
Sincerely yours,
Andrey Murzov
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight