ESRI Sahpe point file

2 posts, 0 answers
  1. Sasa Grebenar
    Sasa Grebenar avatar
    8 posts
    Member since:
    Sep 2012

    Posted 18 Nov 2010 Link to this post

    Dear

    How can I define point style when I show esri shape point layer...

    Best regards

    SASA
  2. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 19 Nov 2010 Link to this post

    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.
    <UserControl x:Class="ESRIShapePoint.MainPage"
        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"
        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
  3. DevCraft banner
Back to Top