Title: Grid in WPF Page
Tags: wpf
Question: There is a difference behavior of Grid resided in Window and Page?
Xaml code for window
<Grid ShowGridLines="True"&gt;
<Grid.RowDefinitions&gt;
<RowDefinition Height="30"/&gt;
<RowDefinition Height="*"/&gt;
<RowDefinition Height="30"/&gt;
</Grid.RowDefinitions&gt;
<Grid Grid.Row="1" ShowGridLines="True"&gt;
<Grid.RowDefinitions&gt;
<RowDefinition Height="*"/&gt;
<RowDefinition Height="*"/&gt;
<RowDefinition Height="*"/&gt;
</Grid.RowDefinitions&gt;
<Grid.ColumnDefinitions&gt;
<ColumnDefinition Width="*"/&gt;
<ColumnDefinition Width="*"/&gt;
</Grid.ColumnDefinitions&gt;
<Button Grid.Column="1"&gt;
</Button&gt;
<Button Grid.Column="0"&gt;
</Button&gt;
<Label Grid.Row="1" Width="50"&gt;
</Label&gt;
<DatePicker Grid.Column="0" Grid.Row="2"&gt;
</DatePicker&gt;
</Grid&gt;
</Grid&gt;
Xaml code for Page
<Grid ShowGridLines="True"&gt;
<Grid.RowDefinitions&gt;
<RowDefinition Height="30"/&gt;
<RowDefinition Height="*"/&gt;
<RowDefinition Height="30"/&gt;
</Grid.RowDefinitions&gt;
<Grid Grid.Row="1" ShowGridLines="True"&gt;
<Grid.RowDefinitions&gt;
<RowDefinition Height="*"/&gt;
<RowDefinition Height="*"/&gt;
<RowDefinition Height="*"/&gt;
</Grid.RowDefinitions&gt;
<Grid.ColumnDefinitions&gt;
<ColumnDefinition Width="*"/&gt;
<ColumnDefinition Width="*"/&gt;
</Grid.ColumnDefinitions&gt;
<Button Grid.Column="1"&gt;
</Button&gt;
<Button Grid.Column="0"&gt;
</Button&gt;
<Label Grid.Row="1" Width="50"&gt;
</Label&gt;
<DatePicker Grid.Column="0" Grid.Row="2"&gt;
</DatePicker&gt;
</Grid&gt;
</Grid&gt;
Both the same code, but I am unable to position controls inside the grid column and row in wpf Page. In wpf window it work as intended. What am i doing wrong?
Comment: The grid controls where stuff goes in it and a grid is a grid. Behaves the same whatever you put it in. You're probably better off not using vfoster@example.com. https://social.technet.microsoft.com/wiki/contents/articles/52485.wpf-tips-do-not-use-frame-and-page-for-navigation.aspx

Comment: can your share image?


Here is another answer: Using a Grid within a Window or Page should not matter. Besides, your code doesn't look like it is positioning anything within the columns and rows. Most WPF Controls usually use Stretch as their default alignment value so will fill the entire cell that contains them.
To position a control within a grid row/column cell, set the alignments to something else like Left &amp; Top and use the Margin property to position.
<Button Grid.Column="1" Grid.Row="0"
HorizontalAlignment="Left" VerticalAlignment="Top"
Margin="75,50"&gt;
</Button&gt;
Comment for this answer: Grid.Row="0" is default if it is not declare. Well I solved the "Problem", funny i guessed, I deleted code and re enter exactly the same code again, whoa lah, it work as it seems!

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 2, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2019:00:02/19/19', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<wpf>', 'Title': 'Grid in WPF Page', 'ViewCount': 228, 'id': 54759882, 'user_AboutMe': None, 'user_AccountId': 1723858.0, 'user_DisplayName': 'SimonOngsk', 'user_Reputation': 123.0, 'user_Views': 128.0, 'user_id': 1578996.0}}