Custom MapPinPoints

4 posts, 1 answers
  1. Esther
    Esther avatar
    13 posts
    Member since:
    Jun 2010

    Posted 07 Feb 2011 Link to this post

    Hello,
    I´ve some PinPoints that are represented by a png image. I´d like to draw a number in the middle of the image. If I use the property Text of the MapPinPoint the text is drawn on the right side of the image.
    Is there any simple way of doing that?
    Thank you very much,
    Esther
  2. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 09 Feb 2011 Link to this post

    Hello Esther,

    You can create your own template for the MapPinPoint control. For example:

    <Style TargetType="telerik:MapPinPoint">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="telerik:MapPinPoint">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}" 
                            BorderThickness="1" 
                            CornerRadius="3"
                            Padding="2,2,2,2">
                        <Grid Name="PART_Panel">
                            <Image Name="PART_Image" 
                                   Stretch="None" 
                                   Source="{TemplateBinding ImageSource}" 
                                   Width="32" 
                                   Height="32" />
                            <TextBlock Name="PART_Text" 
                                   VerticalAlignment="Center" 
                                   HorizontalAlignment="Center"
                                   Text="{TemplateBinding Text}" />
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    I hope this helps.

    Kind regards,
    Andrey Murzov
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Esther
    Esther avatar
    13 posts
    Member since:
    Jun 2010

    Posted 09 Feb 2011 Link to this post

    Thank you,
    But, where do I have to declare exactly that custom style? in another file? in the map xaml?
    And then, How do I assign this style to the PinPoints I want?
    Thanks again,
    Esther
  5. Answer
    Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 14 Feb 2011 Link to this post

    Hi Esther,

    Like any other styles in WPF this one can be declared in many different places in your application: App.xaml, XAML wich uses RadMap, external resource dictionary and so on. When the style is defined without x:Key attribute it is applied to all controls of this type authomatically.

    Kind regards,
    Andrey Murzov
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Back to Top