Select to view content in your preferred language

Sizing to fit the screen

1595
3
05-12-2010 02:46 PM
DonFreeman
Emerging Contributor
I could use some help setting up my Silverlight based map to fit the screen regardless of the users screen resolution. My situation is this: The Silverlight map is hosted in a grid containing 3 rows and 3 columns. The map is in the second column second row (center cell). I want to set the width of the first column(0) to a fixed width of 250 and the width of the third column to 10.  I want the second column to float to take the remainder of the available screen and the map to fill the column it is in. All of my attempts to use auto width options and width="*" etc. have resulted in a tiny map and the grid collapsed to fit it. The only way I can get a decent sized map is to set a fixed width for the center column which leaves unused space on the screen if the user has a higher resolution monitor. What am I missing?

Thanks
0 Kudos
3 Replies
DominiqueBroux
Esri Frequent Contributor
Looks working for me with something like :

<Grid x:Name="LayoutRoot">
    <Grid.RowDefinitions>
        <RowDefinition Height="10" ></RowDefinition>
        <RowDefinition Height="*" ></RowDefinition>
        <RowDefinition Height="30" ></RowDefinition>
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="250" />
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="10" />
    </Grid.ColumnDefinitions>
 
    <!-- Map Control -->
    <esri:Map x:Name="Map" Background="White" Grid.Row="1" Grid.Column="1">
.......


Rows/Columns 0 and 2 have fixed sizes and the map in row 1/Column 1 is using the remaining space.

/Dominique
0 Kudos
DonFreeman
Emerging Contributor
That's exactly the way I thought it should be, but it doesn't work for me. The map ends up being collapsed to almost nothing.
0 Kudos
DonFreeman
Emerging Contributor
For anyone interested, I did find the answer to this problem. I had 2 grids and a stackpanel nested together. The problem was solved by removing the inside grid and stack panel.
0 Kudos