Note that there are some explanatory texts on larger screens.

plurals
  1. POWPF Resize while keeping a fixed height?
    primarykey
    data
    text
    <p>I have a WPF application I'm working on and the form is being built using images...I've run into a problem though with resizing the form.</p> <p>The issue is that for the individual row backgrounds at the top I need to keep the height at a fixed size, while allowing the width to resize to fit the window...However any time I try to put a height or max height value or anything like that the image control stops fitting the window entirely.</p> <p>Now I may be going about this entirely the wrong way as I'm newish to WPF so if anyone has a better way of doing this please let me know.</p> <p>This is the XAML I'm using so far, the issue is with the TitleBarImage:</p> <pre><code>&lt;Window x:Class="App.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Application" Height="{Binding SystemParameters.PrimaryScreenHeight}" Width="{Binding SystemParameters.PrimaryScreenWidth}" AllowsTransparency="True" WindowStyle="None" MinWidth="1024" MinHeight="749" WindowStartupLocation="CenterScreen"&gt; &lt;Grid&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition/&gt; &lt;RowDefinition/&gt; &lt;/Grid.RowDefinitions&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition/&gt; &lt;ColumnDefinition/&gt; &lt;ColumnDefinition/&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;Image x:Name="TitleBarImage" Grid.Row="0" Grid.ColumnSpan="3" HorizontalAlignment="Stretch" VerticalAlignment="Top" Source="skin/title-bar.png" MouseLeftButtonDown="TitleBarImage_MouseLeftButtonDown" MouseDown="TitleBarImage_MouseDoubleClick"/&gt; &lt;Image HorizontalAlignment="Right" Grid.Row="0" Grid.Column="2" Height="23" Margin="0,17,74,0" VerticalAlignment="Top" Width="34" Source="skin/min-button.png" MouseLeftButtonUp="MinImage_MouseLeftButtonUp"/&gt; &lt;Image HorizontalAlignment="Right" Grid.Row="0" Grid.Column="2" Height="23" Margin="0,17,40,0" VerticalAlignment="Top" Width="34" Source="skin/max-button.png" MouseLeftButtonUp="MaxImage_MouseLeftButtonUp"/&gt; &lt;Image HorizontalAlignment="Right" Grid.Row="0" Grid.Column="2" Height="23" Margin="0,17,7,0" VerticalAlignment="Top" Width="33" Source="skin/close-button.png" MouseLeftButtonUp="Image_MouseLeftButtonUp_1" RenderTransformOrigin="21.121,-4.522"/&gt; &lt;/Grid&gt; &lt;/Window&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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