Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

How to make label Style static (size) while Listbox stetches during Window resize?

$
0
0

Here is the scenario -- I want the yellow Label to remain the same size (as in the first picture) when the window gets resized (just like the button below remains the same size), but I want the listbox to stretch -- which the listbox is doing -- as desired.  How to achieve this effect?  (xaml below)

<Window x:Class="ExpesneIt.Window2"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Window2" Height="300" Width="500"><Grid><Grid.Background><ImageBrush ImageSource="watermark.png"  /></Grid.Background><Grid.ColumnDefinitions><ColumnDefinition Width="230" /><ColumnDefinition /></Grid.ColumnDefinitions><Grid.RowDefinitions><RowDefinition/><RowDefinition Height="Auto"/><RowDefinition /><RowDefinition Height="Auto"/></Grid.RowDefinitions><!-- People list --><Label Grid.Column="1" Style="{StaticResource headerTextStyle}" >
            View Expense Report</Label><Border Grid.Column="1" Grid.Row="1"><Label  Style="{StaticResource headerTextStyle}" Background="#FFE8F045" Margin="0,0,132,0" >Names</Label></Border><ListBox Name="peopleListBox" Grid.Column="1" Grid.Row="2"></ListBox><Button Grid.Column="1" Grid.Row="3" Style="{StaticResource buttonStyle}">View</Button></Grid></Window>

the Style="{StaticResource headerTextStyle}" on the label does not seem to be having the desired effect.  How to make the label remain static?

Thanks


Rich P


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>