WPF中控件显示有关问题,Z轴显示不对
WPF中控件显示问题,Z轴显示不对
我在GroupBox控件中有一个ListBox
我想让ListBox显示在GroupBox之上,怎么设置都不对,能不能显示啊
lstSsite这个控件总是被GroupBox遮住了
------解决方案--------------------
晕!
子控件再怎么设置,它也是从属于父控件的,不可能越俎代庖啊。如果你想设置ZIndex,首先要确定它们是并行同级的控件,才有意义。
------解决方案--------------------
比如说一个TextBox的Index是1000,然后下一个Grid的ZIndex是999,Grid里边有个TextBlock的ZIndex是1001,TextBlock怎么可能会遮挡住TextBox呢?它首先是归于那么ZIndex为990的Panel里边的子控件,永远也不可能盖住浮动在自己的父控件上面的TextBox的。
------解决方案--------------------
textbox 改 AutoCompleteBox 试试
我在GroupBox控件中有一个ListBox
我想让ListBox显示在GroupBox之上,怎么设置都不对,能不能显示啊
- XML code
<GroupBox Header="运输信息" Panel.ZIndex="5"> <StackPanel Orientation="Horizontal"> <Label Content="代单号:"></Label> <TextBox Name="txtOrderid" Width="130" Height="20"></TextBox> <Label Content="起点:" Margin="30,0,0,0"></Label> <Canvas Width="130" Panel.ZIndex="7"> <TextBox Name="txtSstie" Width="130" Height="20" PreviewKeyUp="txtSstie_PreviewKeyUp"></TextBox> <ListBox Name="lstSsite" Width="130" Margin="0,20,0,0" Height="70" Visibility="Collapsed" > <ListBoxItem Content="sdfafdas" /> <ListBoxItem Content="asdfasdfasdfsa" /> <ListBoxItem Content="asdfadfasd" /> </ListBox> </Canvas> <Label Content="终点:"></Label> <Canvas Width="130"> <TextBox Name="txtEstie" Width="130" Height="20"></TextBox> <ListBox Name="lstEsite" Width="130" Margin="0,20,0,0" Visibility="Collapsed"></ListBox> </Canvas> <Label Content="运输方式:" Margin="30,0,0,0"></Label> <ComboBox Name="cmbTranWay" Width="90"></ComboBox> </StackPanel> </GroupBox>
lstSsite这个控件总是被GroupBox遮住了
------解决方案--------------------
晕!
子控件再怎么设置,它也是从属于父控件的,不可能越俎代庖啊。如果你想设置ZIndex,首先要确定它们是并行同级的控件,才有意义。
------解决方案--------------------
比如说一个TextBox的Index是1000,然后下一个Grid的ZIndex是999,Grid里边有个TextBlock的ZIndex是1001,TextBlock怎么可能会遮挡住TextBox呢?它首先是归于那么ZIndex为990的Panel里边的子控件,永远也不可能盖住浮动在自己的父控件上面的TextBox的。
------解决方案--------------------
textbox 改 AutoCompleteBox 试试