Size of the map

3 posts, 0 answers
  1. Mapi
    Mapi avatar
    9 posts
    Member since:
    Jul 2010

    Posted 22 Jul 2010 Link to this post

    Hello everyone!

    I am currently trying to display a map in a window using WPF. Unfortunately, I do not succeed in changing the size of the map.
    In my WPF view I have two buttons and my RadMap control, and if I manually change the width and height of the RadMap object the buttons disappear but also the zoom control which is supposed to be on the map.

    Here is my code:

    <Window x:Class="WpfRadMapApplication.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
        MinHeight="300" MinWidth="300"
        Height="600" Width="600">
        <Grid HorizontalAlignment="Center" VerticalAlignment="Top">
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="*" />
                <RowDefinition Height="10*"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Button Grid.Row="0" Grid.Column="0" Name="map24Button" Content="Map24" Margin="5" HorizontalAlignment="Center" Click="map24Button_Click" />
            <Button Grid.Row="1" Grid.Column="0" Name="openStreetMapButton" Content="OpenStreetMap" Margin="5" HorizontalAlignment="Center" Click="openStreetMapButton_Click" />
            <telerik:RadMap Grid.Row="2"
                        Grid.Column="0"
                        Name="radMap"
                        ZoomLevel="0"
                        Center="0,0"
                        Background="White"
                        HorizontalAlignment="Center">
            </telerik:RadMap>
        </Grid>
    </Window>

    Thanks for your help :)!
  2. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 23 Jul 2010 Link to this post

    Hello Mapi,

    You can use "Auto" as Height value in row definitions for buttons and "*" for the map.
    The sample code of stretchable layout for a window is the following:
    <Window x:Class="WpfRadMapApplication.MainWindow"
        MinHeight="300" MinWidth="300"
        Height="600" Width="600">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Button Grid.Row="0" Grid.Column="0" Name="map24Button" Content="Map24" Margin="5" HorizontalAlignment="Center" Click="map24Button_Click" />
            <Button Grid.Row="1" Grid.Column="0" Name="openStreetMapButton" Content="OpenStreetMap" Margin="5" HorizontalAlignment="Center" Click="openStreetMapButton_Click" />
            <telerik:RadMap Grid.Row="2"
                        Grid.Column="0"
                        Name="radMap"
                        ZoomLevel="0"
                        Center="0,0"
                        Background="White">
            </telerik:RadMap>
        </Grid>
    </Window>

    All the best,
    Andrey Murzov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Mapi
    Mapi avatar
    9 posts
    Member since:
    Jul 2010

    Posted 23 Jul 2010 Link to this post

    Thanks, it perfectly works now!
Back to Top