Projekt WPF, zmniejszenie jednego paska jakby.

0

Mam taki problem. Chciałbym zrobić wąski pasek (na screenie zamieszczę o co mi chodzi), ale robiąc tak jak na kodzie niżej wychodzi równy podział. Jak zrobić pożądany efekt?

<Window x:Class="WpfApp1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfApp1"
        mc:Ignorable="d"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <StackPanel Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="4" Background="LightGray" >
            <Label Content="Jakis testowy napis." />
            <Button Content="Przycisk" HorizontalAlignment="Right" />
        </StackPanel>
    </Grid>
</Window>

1
<Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="3*" />
            <RowDefinition Height="3*" />
        </Grid.RowDefinitions>
0

@neves: i inni.

Ale jak robię takie cuda, to mi się wyświetla to linia pod linijką, ale chciałbym na tej samej wysokosci.

<Window x:Class="WpfApp1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfApp1"
        mc:Ignorable="d"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="5*" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <StackPanel Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="4" Background="LightGray" VerticalAlignment="Center" >
            <Label Content="Jakis testowy napis." />
            <Button Content="Przycisk" HorizontalAlignment="Right"/>
        </StackPanel>
    </Grid>
</Window>

1

Problem masz pewnie ze stackpanelem, jego się stosuje do układania bezpośrednio w jakimś porządku np. pod sobą. Spróbuj użyć wrappanelu.

1 użytkowników online, w tym zalogowanych: 0, gości: 1