Note that there are some explanatory texts on larger screens.

plurals
  1. POmake user control stretch to all given space
    text
    copied!<p>I have some user control that I am putting in a window control , i dont want to have a fixed size in the user control i want it to catch all the space were i put it . What should i add to my code ?</p> <pre><code> &lt;UserControl x:Class="DBTool.View.SelectDataBase" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" &gt; &lt;UserControl.Background &gt; &lt;ImageBrush ImageSource="..\Resources\DBSelection.jpg" &gt;&lt;/ImageBrush &gt; &lt;/UserControl.Background &gt; &lt;Grid&gt; &lt;ItemsControl FontWeight="Normal" ItemsSource="{Binding Path=AvailableBeanTypes}" &gt; &lt;ItemsControl.ItemTemplate&gt; &lt;DataTemplate&gt; &lt;RadioButton Content="{Binding Path=DisplayName}" IsChecked="{Binding Path=IsSelected}" GroupName="BeanType" Margin="2,3.5" /&gt; &lt;/DataTemplate&gt; &lt;/ItemsControl.ItemTemplate&gt; &lt;/ItemsControl&gt; &lt;/Grid&gt; &lt;/UserControl&gt; </code></pre> <p>My window code </p> <pre><code>&lt;Window x:Class="DBTool.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:View="clr-namespace:DBTool.View" xmlns:ViewModel="clr-namespace:DBTool.ViewModel" Title="MainWindow" Height="332" Width="528" &gt; &lt;Window.Resources&gt; &lt;!-- These four templates map a ViewModel to a View. --&gt; &lt;DataTemplate DataType="{x:Type ViewModel:SelectDataBaseViewModel}"&gt; &lt;View:SelectDataBase /&gt; &lt;/DataTemplate&gt; &lt;DataTemplate DataType="{x:Type ViewModel:MySqlPageViewModel}"&gt; &lt;View:MySqlPageView /&gt; &lt;/DataTemplate&gt; &lt;/Window.Resources&gt; &lt;DockPanel LastChildFill="True" &gt; &lt;ToolBar Height="26" HorizontalAlignment="Stretch" VerticalAlignment="Top" Name="toolBar1" Width="Auto" DockPanel.Dock="Top" /&gt; &lt;Grid VerticalAlignment="Bottom" DockPanel.Dock="Bottom" &gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition/&gt; &lt;/Grid.RowDefinitions&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition/&gt; &lt;ColumnDefinition/&gt; &lt;ColumnDefinition/&gt; &lt;ColumnDefinition/&gt; &lt;ColumnDefinition/&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;Button Grid.Row="0" Grid.Column="4" Background="Azure" Margin="10" Command="{Binding Path=MoveNextCommand}" &gt; Next &lt;/Button&gt; &lt;Button Grid.Row="0" Grid.Column="3" Background="Azure" Margin="10" Command="{Binding Path=MovePreviousCommand}"&gt; Previous &lt;/Button&gt; &lt;TextBox Name="txtInput" Grid.Column="1"/&gt; &lt;Label Content="{Binding Text, ElementName=txtInput, UpdateSourceTrigger=PropertyChanged}" Grid.Column="2" /&gt; &lt;/Grid&gt; &lt;!-- &lt;View:SelectDataBase x:Name="DetailView"/&gt;--&gt; &lt;Border Background="White" Grid.Column="1" Grid.Row="0"&gt; &lt;HeaderedContentControl Content="{Binding Path=CurrentPage}" Header="{Binding Path=CurrentPage.DisplayName}" /&gt; &lt;/Border&gt; &lt;/DockPanel&gt; &lt;/Window&gt; </code></pre> <p><img src="https://i.stack.imgur.com/yi3Jl.png" alt="enter image description here"></p> <p>But i want to see the image take the whole white space there .</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload