增加WPF中Border的高度 [英] Increase the height of Border in WPF

查看:192
本文介绍了增加WPF中Border的高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个边框控件,里面我在WPF中有一个网格



I have a border control and inside that i have a grid in WPF

<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??

<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.

推荐答案

高度和宽度由内容定义,此元素的内部内容。







您仍然没有提供真正显示问题的代码示例,但问题不在于边框,甚至没有关闭。这是关键:

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
The height and width is defined by Content, inner content of this element.



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


这篇关于增加WPF中Border的高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆