1

I've been looking on Google and all over the place for the answer on this, but I'm coming up empty. I'm trying to make a few windows on my Windows universal app software. I want it to be able to resize itself as the user makes the window bigger or smaller. I can't find anywhere on the properties where it says anchor, and I'm not finding any help with the auto complete with the .xaml.

Any help on this will be welcome

UPDATE for – Justin XL or anyone that can answer

Below is a image of what I'm seeing. I'm trying to get all 4 blocks to take equal space at any given time. Obviously that isn't what I'm getting. Anyways, I hope you can take a quick look at the code below the picture to tell me what I'm doing wrong.

What I'm seeing

The code below is what I'm using. I'm not sure if I'm doing something wrong since this is my first Windows app.

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="*" />
    </Grid.ColumnDefinitions>
    <Grid.RowDefinitions>
        <RowDefinition Height="*"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>
    <Grid Background="Gainsboro" Grid.Column="1" Width="Auto" Height="Auto">
    <Button x:Name="Click_Me" Grid.Column="1" Content="Click Me"  HorizontalAlignment="Center"  VerticalAlignment="Center" Click="Click_Me_Click" Width="107" /></Grid>

    <Grid Background="Gainsboro" Grid.Column="1" Grid.Row="1" Width="Auto" Height="Auto">
    <TextBlock x:Name="textBlock" HorizontalAlignment="Center"  TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Center" Grid.Row='1'/></Grid>


    <Rectangle Fill="Gainsboro" Width="8" Margin="622,0,10,0" VerticalAlignment="Stretch"/>

    <Grid  Grid.Column="0">
        <WebView Name="Video"  VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Width="Auto" Height="Auto"  Grid.Row="0"  Grid.Column="0"  />

</Grid>
crua9
  • 228
  • 3
  • 11
  • Google how a `Grid` works. – Justin XL Oct 18 '15 at 07:44
  • Thanks for pointing me on the right path. It's 4 am here, and I've been looking for this answer for hours now. I will let you know if this helps. Btw, this is my first Windows app. – crua9 Oct 18 '15 at 08:19
  • Good luck! :) And maybe [this](http://stackoverflow.com/questions/32362064/anchor-a-textbox-to-the-right-and-left-so-it-s-stretched-when-parent-is-resized/32364646#32364646) would help? – Justin XL Oct 18 '15 at 08:45
  • 1
    You have no idea how much that little push to look up grid help me. Please use the answer button so I can mark you as the one who answer the question. Again, thank you. – crua9 Oct 18 '15 at 09:35
  • I am running into a problem with setting up my code on this. I'm not sure if my code above will help on finding my problem. – crua9 Oct 18 '15 at 10:44
  • Your code looks fine to me except the `Rectangle` is misplaced. – Justin XL Oct 18 '15 at 11:02
  • Without the Rectangle, the left side hardly shows at all. Could this be a bug that is making it where these things are happening? – crua9 Oct 18 '15 at 11:44
  • I think you need to show more of your code. – Justin XL Oct 18 '15 at 20:01
  • https://github.com/crua9/Tech-Reviews-and-Help-Windows-app Here is all of it. I'm trying to make an app that will teach others how to code and do other things. I have a background in computer security and mobile coding, but I wanted to get into Windows UA coding for a while now. I figure as I come across my own questions, I can show people how to deal with the problems. Anyways, I have a feeling that the problem maybe coming in with the side menu I have, but I can't find a better way to do quick jumps across the app when needed. – crua9 Oct 18 '15 at 21:32

1 Answers1

3

First, you should remove HorizontalAlignment="Left" on your MySplitView to make the content fill the entire page.

Also, I would change your hard-coded Margin on the Rectangle to -

<Rectangle Fill="Gainsboro" Width="8" VerticalAlignment="Stretch" HorizontalAlignment="Right" Margin="0,0,-4,0" />

Note the -4px(right margin) here. It's because the Rectangle itself is 8px wide and aligned on the edge of the first cell in the Grid, so I shifted it to the right by 4px to make it absolutely sit in the middle of the page.

Hope this helps!

Justin XL
  • 38,763
  • 7
  • 88
  • 133
  • I gave you a shout out on my YouTube channel for helping me out. https://www.youtube.com/watch?v=6trqU8YFLWs Again, thanks for the help – crua9 Oct 20 '15 at 06:09
  • Awesome tutorial! Cheers. – Justin XL Oct 20 '15 at 06:18
  • Maybe you can help me out on another problem. I'm trying to make a page where the left side is a map, and the right side has 2 boxes for info. I'm having trouble setting up the grid so the map can taken up the entire left side of the screen. http://stackoverflow.com/questions/33448355/is-there-a-way-to-make-a-off-center-grid-with-windows-10-ua – crua9 Oct 31 '15 at 20:25