读书人

WPF中控件显示有关问题Z轴显示不对,

发布时间: 2012-09-14 23:00:49 作者: rapoo

WPF中控件显示问题,Z轴显示不对,控件被遮住
我在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遮住了


[解决办法]
我刚测试了一下,lstSsite显示正常啊,你单独测一下吧
C# code
        private void txtSstie_PreviewKeyUp(object sender, KeyEventArgs e)        {            lstSsite.Visibility = Visibility.Visible;        } 

读书人网 >C#

热点推荐