This question is locked. New answers and comments are not allowed.
Hello
How can I style a line on the map? I have a single InformationLayer with a
I copied one of the demos to style my polygons:
However I can't figure out what properties are used for lines.
Thank you.
How can I style a line on the map? I have a single InformationLayer with a
SqlGeospatialDataReader
that contains point, areas, and lines.I copied one of the demos to style my polygons:
<
telerik:InformationLayer.ShapeFill
>
<
telerik:MapShapeFill
Fill
=
"#7FFFFFFF"
Stroke
=
"Red"
StrokeThickness
=
"2"
/>
</
telerik:InformationLayer.ShapeFill
>
<
telerik:InformationLayer.HighlightFill
>
<
telerik:MapShapeFill
Fill
=
"#B2FFFFFF"
Stroke
=
"Red"
StrokeThickness
=
"2"
/>
</
telerik:InformationLayer.HighlightFill
>
However I can't figure out what properties are used for lines.
Thank you.
4 Answers, 1 is accepted
0
Curt
Top achievements
Rank 1
Iron
answered on 03 Apr 2012, 04:34 PM
I looked some more at this. It appears that lines use the styles from "MapShapeFill".
However, each end of a line is connected and then a fill is applied, so they appear as un-closed polygons. Please see attached pictures.
I would like the polygons to have a fill, but the lines (poly lines) to not have a fill.
However, each end of a line is connected and then a fill is applied, so they appear as un-closed polygons. Please see attached pictures.
I would like the polygons to have a fill, but the lines (poly lines) to not have a fill.
0
Hello Curt,
The map shape objects use regular Silverlight shapes for visualization. The map shapes provide the same set of the painting properties as the regular Silverlight shapes provide (Fill, Stroke, StrokeThikness and so on). These properties are combined in the MapShapeFill object. So you always can refer to the MSDN as well as to the Telerik documentation for detailed information about painting properties:
http://msdn.microsoft.com/en-us/library/cc189073(v=vs.95).aspx
http://msdn.microsoft.com/en-us/library/system.windows.shapes.shape(v=vs.95).aspx
http://www.telerik.com/help/silverlight/allmembers_t_telerik_windows_controls_map_mapshapefill.html
For example, the MapLine shape uses Stroke and StrokeThikness properties.
Greetings,
The map shape objects use regular Silverlight shapes for visualization. The map shapes provide the same set of the painting properties as the regular Silverlight shapes provide (Fill, Stroke, StrokeThikness and so on). These properties are combined in the MapShapeFill object. So you always can refer to the MSDN as well as to the Telerik documentation for detailed information about painting properties:
http://msdn.microsoft.com/en-us/library/cc189073(v=vs.95).aspx
http://msdn.microsoft.com/en-us/library/system.windows.shapes.shape(v=vs.95).aspx
http://www.telerik.com/help/silverlight/allmembers_t_telerik_windows_controls_map_mapshapefill.html
For example, the MapLine shape uses Stroke and StrokeThikness properties.
Greetings,
Andrey Murzov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Curt
Top achievements
Rank 1
Iron
answered on 07 Apr 2012, 12:44 AM
Andrey
If I have a single information layer, and this information layer contains both lines and polygons, is it possible to apply different fills/strokes to the lines and polygons? For instance, all the polygons have a red stroke with a white fill, and the lines have a blue stroke with no fill.
Thank you.
If I have a single information layer, and this information layer contains both lines and polygons, is it possible to apply different fills/strokes to the lines and polygons? For instance, all the polygons have a red stroke with a white fill, and the lines have a blue stroke with no fill.
Thank you.
0
Hi Curt,
You can use the PreviewReadCompleted event of the SqlGeospatialDataReader. In the event handler you can walk though all elements that have been read and colorize them per type of the shape. For example:
Kind regards,
You can use the PreviewReadCompleted event of the SqlGeospatialDataReader. In the event handler you can walk though all elements that have been read and colorize them per type of the shape. For example:
private
void
Reader_PreviewReadCompleted(
object
sender, PreviewReadShapesCompletedEventArgs eventArgs)
{
if
(eventArgs.Error ==
null
)
{
foreach
(FrameworkElement item
in
eventArgs.Items)
{
MapPolyline polyline = item
as
MapPolyline;
MapPolygon polygon = item
as
MapPolygon;
if
(polyline !=
null
)
{
// Colorize polyline.
polyline.Stroke =
new
SolidColorBrush(Colors.Blue);
polyline.StrokeThickness = 2;
}
else
if
(polygon !=
null
)
{
polygon.Fill =
new
SolidColorBrush(Colors.White);
polygon.Stroke =
new
SolidColorBrush(Colors.Red);
polygon.StrokeThickness = 2;
}
}
}
}
Kind regards,
Andrey Murzov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>