C#C
C#3y ago
RV

❔ Validation Error auto resize parent

How to auto resize parent when has validation error? So that the error text doesn't crash into other components?
(sorry for my bad english)

<Grid Margin="20"
      Width="600">
    <Grid.Resources>
        <Style TargetType="TextBlock">
            <Setter Property="Margin"
                    Value="0 5" />
            <Setter Property="FontSize"
                    Value="20" />
        </Style>
    </Grid.Resources>
    <Grid.RowDefinitions>
        <RowDefinition Height="auto" />
        <RowDefinition Height="auto" />
    </Grid.RowDefinitions>
    <StackPanel Grid.Row="0">
        <TextBlock Text="Nama Kategori *" />
        <controls:PlaceholderTextBox CornerRadius="5"
                                     Text="{Binding CategoryName, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}"
                                     FontSize="20" />
    </StackPanel>
    <StackPanel Orientation="Horizontal"
                Grid.Row="1"
                HorizontalAlignment="Right"
                Margin="0 20 0 0">
        <Button Style="{DynamicResource FlatButton5}"
                Background="#BA4A4A"
                Foreground="White"
                Margin="10 0 0 0"
                Padding="40 10"
                Content="Tutup"
                Command="{Binding CancelCommand}" />
        <Button Style="{DynamicResource FlatButton5}"
                Background="#4B934E"
                Foreground="White"
                Padding="40 10"
                Margin="10 0 0 0"
                Command="{Binding AcceptCommand}"
                Content="Tambah" />
    </StackPanel>
</Grid>
image.png
Was this page helpful?