Click here to Skip to main content
15,893,594 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
I have a border control and inside that i have a grid in WPF

C#
<Border d:LayoutOverrides="HorizontalAlignment, VerticalAlignment" CornerRadius="15,15,15,15" Focusable="False" x:Name="bdLanguage" removed="#FFA89A6E" BorderBrush="#FF8E8B82" Margin="0,0,-151,0" >


I want to increase the height how can i do it??

HTML
<Border d:LayoutOverrides="HorizontalAlignment, VerticalAlignment" CornerRadius="15,15,15,15" Focusable="False" x:Name="bdLanguage" removed="#FFA89A6E" BorderBrush="#FF8E8B82" Margin="0,0,-151,0" >
        		<Grid Width="Auto" Height="Auto" VerticalAlignment="Stretch">
        			<Grid.ColumnDefinitions>
        				<ColumnDefinition Width="0.359*"/>
        				<ColumnDefinition Width="0.28*"/>
        				<ColumnDefinition Width="0.361*"/>
        			</Grid.ColumnDefinitions>
        			<Grid.RowDefinitions>
        				<RowDefinition Height="0"/>
        				<RowDefinition Height="11"/>
        				<RowDefinition Height="44"/>
        				<RowDefinition Height="54.5"/>
        				<RowDefinition Height="50"/>
        				<RowDefinition Height="40.5"/>
        				<RowDefinition Height="20"/>
        			</Grid.RowDefinitions>
        			<Label x:Name="lblCurrentLanguage" Height="23" Focusable="False" Content="" Width="Auto" Visibility="Hidden" HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Row="1" Grid.RowSpan="2"/>
        			<Label x:Name="lblCurrentLanguageDisplay" Height="23" Focusable="False" Visibility="Hidden" HorizontalAlignment="Left" Margin="60,0,0,0" VerticalAlignment="Top" Grid.Column="0" Grid.Row="1" Grid.RowSpan="2"/>
        			<Label x:Name="lblSelectLanguage" Content="" Width="Auto" Focusable="False"  Height="23" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="15,0,0,0" Grid.Row="2" />
        			<ComboBox ItemsSource="{Binding}" x:Name="cmbSelectLanguage" IsSynchronizedWithCurrentItem="True" SelectionChanged="cmbSelectLanguage_SelectionChanged" Height="25" HorizontalAlignment="Stretch" MinHeight="0" MinWidth="0" VerticalAlignment="Center" Grid.Column="1" Grid.Row="2" Grid.ColumnSpan="1" Margin="3,0,3,0" Width="175" />
        			<Label x:Name="lblSelectDateFormat" Focusable="False" HorizontalAlignment="Left" Margin="15,0,0,0" VerticalAlignment="Center" Grid.Row="3" Grid.RowSpan="1"/>
        			<ComboBox x:Name="cmbDateFormat" SelectionChanged="cmbDateFormat_SelectionChanged" Height="25" Grid.Column="1" Grid.Row="3" Grid.ColumnSpan="1" VerticalAlignment="Center" Margin="3,0,3,0" Width="175" />
        			<Label x:Name="lblSelectTimeFormat" Focusable="False" Height="23" HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Row="4" Margin="15,0,0,0"/>
        			<ComboBox x:Name="cmbTimeFormat" SelectionChanged="cmbTimeFormat_SelectionChanged" Height="25" Margin="3,7.5,3,12.5" VerticalAlignment="Stretch" Grid.Column="1" Grid.Row="4" Grid.ColumnSpan="1" Width="175" />
                    <ComboBox RenderTransformOrigin="0.5,0.5" x:Name="cmbUnits" VerticalAlignment="Center" Height="25" Grid.Column="1" Grid.Row="5" IsSynchronizedWithCurrentItem="True" SelectionChanged="cmbUnits_SelectionChanged" Grid.ColumnSpan="1" Margin="3,0,3,0" Width="175" /> 
                    <Label HorizontalAlignment="Left" Focusable="False" Margin="15,0,0,0" x:Name="lblSelectUnit" VerticalAlignment="Center" Height="23" VerticalContentAlignment="Center" Content="" Grid.Row="5"/>
        			<ComboBox HorizontalAlignment="Stretch" x:Name="cmbSelectSubUnits" Grid.Row="5" IsSynchronizedWithCurrentItem="True" Grid.Column="2" Grid.RowSpan="1" Grid.ColumnSpan="1" SelectionChanged="cmbSubUnits_SelectionChanged" Margin="9.5,0,68.5,0" Height="25" VerticalAlignment="Center" Width="175" />
        			<Label HorizontalAlignment="Left" x:Name="lblSelectSubUnit" Focusable="False" VerticalAlignment="Center" Content="" Grid.Row="5" VerticalContentAlignment="Center" Margin="15,0,0,0" Grid.RowSpan="1" Visibility="Hidden"/>
                    <Label x:Name="lblOVUnit" Content="Select OV Unit" Width="Auto" Focusable="False" Height="23" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="15,0,0,0" Grid.Row="7" />
        			                    
                </Grid>
        	</Border>

I have inserted the last label but the border or grid is not stretching so i am unable to see the label fully.
Posted
Updated 2-Sep-14 22:41pm
v2
Comments
Sergey Alexandrovich Kryukov 3-Sep-14 3:13am    
What's wrong with just reading original MSDN documentation?
—SA
Abhinav S 3-Sep-14 3:24am    
Do you mean height of control or thickness of the border?
chandra sekhar 3-Sep-14 4:42am    
I updated the question,not the thickness of the border i am adding one more control but i am unable to see it

1 solution

The height and width is defined by Content, inner content of this element.

[EDIT]

You still did not provide the code sample really manifesting the problem, but the problem is not the Border, not even close. This is the key:
http://msdn.microsoft.com/en-us/library/system.windows.window.sizetocontent(v=vs.110).aspx[^].

One thing you really need to understand: http://msdn.microsoft.com/en-us/library/bb613548%28v=vs.110%29.aspx[^].

—SA
 
Share this answer
 
v5
Comments
chandra sekhar 3-Sep-14 3:18am    
Even though i set the Height there is no change.
Sergey Alexandrovich Kryukov 3-Sep-14 3:27am    
Here is the problem: you are showing a fragment, not complete code sample. How are you using this border? really no content?
Then the size is defined by Padding...

If you are trying something else, please 1) explain precisely your expected layout; 2) create some simple but 100% complete ZAML, without any detail except this very problem; 3) explain what is the problem; why do you think what you see is not what you get.
In this case, use "Improve question". Format XAML properly in HTML, make sure the code is well readable. If you do that, I'm sure I'll be able to help you.

—SA
chandra sekhar 3-Sep-14 4:42am    
I have updated the question.
Sergey Alexandrovich Kryukov 3-Sep-14 10:23am    
That's better, but... you may find it funny, but this is not an adequate example. I asked you XAML. This is not XAML, this is the fragment without the root element, which does not show the root of the problem. :-)

Why is that important? Is it a window or user control. For window, how its size is defined. Size of the window can define the size of content, or the size of content can define the size of the window. This is the key.

Besides, not need to show so big content inside the border. Maybe just one label would be enough.

—SA
Sergey Alexandrovich Kryukov 3-Sep-14 10:26am    
That's better, but... you may find it funny, but this is not an adequate example. I asked you XAML. This is not XAML, this is the fragment without the root element, which does not show the root of the problem. :-)

Why is that important? Is it a window or user control. For window, how its size is defined. Size of the window can define the size of content, or the size of content can define the size of the window. This is the key.

Besides, not need to show so big content inside the border. Maybe just one label would be enough.

—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900