增加WPF中Border的高度

编程入门 行业动态 更新时间:2024-10-24 20:23:34
本文介绍了增加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.

推荐答案

高度和宽度由内容定义,此元素的内部内容。 您仍然没有提供真正显示问题的代码示例,但问题不在于边框,甚至没有关闭。这是关键: msdn.microsoft/en-us/library/system.windows.window.sizetocontent(v = vs.110).aspx [^]. One thing you really need to understand: msdn.microsoft/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: msdn.microsoft/en-us/library/system.windows.window.sizetocontent(v=vs.110).aspx[^]. One thing you really need to understand: msdn.microsoft/en-us/library/bb613548%28v=vs.110%29.aspx[^].
—SA

更多推荐

增加WPF中Border的高度

本文发布于:2023-11-23 03:23:17,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1619899.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:高度   WPF   Border

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!