0

I'm developing a resolution independent application in WPF. I am using mahapps metro controls in my application. I have a grid which is divided into rows and columns in * and 4 TextBoxes are occupying specific rows and columns in that grid. The problem is that the TextBox is not occupying the row as in the bottom border of Textbox is not visible but when I change style to x:Null the problem disappears. Is this a problem specific to metro TextBox?. I tried VerticalAlignment = "Stretch" but this does'nt help. Also the bottom part is visible in higher resolution like 1440 X 900 but not in 1366 X 768. What am I missing?

<Grid Background="Azure">
        <Grid.RowDefinitions>
            <RowDefinition Height="13.1578*"/>
            <RowDefinition Height="4.8157*"/>
            <RowDefinition Height="13.1578*"/>
            <RowDefinition Height="4.8157*"/>
            <RowDefinition Height="13.1578*"/>
            <RowDefinition Height="4.8157*"/>
            <RowDefinition Height="13.1578*"/>
            <RowDefinition Height="4.8157*"/>
            <RowDefinition Height="13.1578*"/>
            <RowDefinition Height="4.8157*"/>
            <RowDefinition Height="18.4210*"/>
            <RowDefinition Height="4.8157*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="5*"/>
            <ColumnDefinition Width="90*"/>
            <ColumnDefinition Width="5*"/>
        </Grid.ColumnDefinitions>

        <Grid Grid.Row="0" 
              Grid.RowSpan="12" 
              Grid.Column="0" 
              Grid.ColumnSpan="3">
            <Border BorderBrush="Black" 
                    BorderThickness="1"/>
        </Grid>
        <TextBox x:Name="txt_1" 
                 Controls:TextBoxHelper.Watermark="Textbox 1" 
                 Style="{x:Null}" 
                 Grid.Row="2" 
                 Grid.Column="1"/>
        <TextBox x:Name="txt_2" 
                 Controls:TextBoxHelper.Watermark="Textbox 2" 
                 Style="{x:Null}" 
                 TextWrapping="Wrap" 
                 Grid.Row="4" 
                 Grid.Column="1"/>
        <TextBox x:Name="txt_3" 
                 Controls:TextBoxHelper.Watermark="Textbox 3" 
                 Style="{x:Null}" 
                 TextWrapping="Wrap" 
                 Grid.Row="6" 
                 Grid.Column="1"/>
        <TextBox x:Name="txt_4" 
                 Controls:TextBoxHelper.Watermark="Textbox 4" 
                 VerticalAlignment="Stretch" 
                 TextWrapping="Wrap" 
                 Grid.Row="8" 
                 Grid.Column="1"/>
        <Grid Grid.Row="10" 
              Grid.Column="1">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="32.5*"/>
                <ColumnDefinition Width="35*"/>
                <ColumnDefinition Width="32.5*"/>
            </Grid.ColumnDefinitions>
        <Button x:Name="btn_add" 
                Content="Add" 
                Grid.Row="8" 
                Grid.Column="1" 
                Click="btn_add_Click"/>
        </Grid>
       <StackPanel Background="#C0F368" 
                   Grid.Row="0" 
                   Grid.Column="0" 
                   Grid.ColumnSpan="3">
    </Grid>`
Ketan Dubey
  • 430
  • 8
  • 19
  • 1
    If I remember right those style templates have a `MinHeight` Setter on them. You might look at that and do a quick test at the instance by setting the property `MinHeight="0"` or something on one of the TextBox instances with the style to see if that's your culprit in which case you'd just go edit that property setter. – Chris W. Aug 02 '17 at 16:35
  • Yes that displays the bottom border, but how do I change it in the entire project? – Ketan Dubey Aug 02 '17 at 17:10
  • 1
    Well, you could either edit it at the default style template in mahapps, or override it as a Style in your app resource dictionary and use `BasedOn` to inherit everything else from the mahapps style template. Personally I would probably just edit the default one. – Chris W. Aug 02 '17 at 18:22

0 Answers0