Unable to see status bar

爷,独闯天下 提交于 2019-12-11 16:16:20

问题


I was just trying to create a window with Status bar and I am not able to see the status bar with as simple code as below. Could anyone tell me what could be the cause? or is it happening only in machine! I restarted VS and also my machine. I am using VS2013 Express edition

<Window x:Class="TemplateBindingSample.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525">
<DockPanel>
    <StatusBar DockPanel.Dock="Bottom">
    </StatusBar>
    <Label>StatusBar Example</Label>
</DockPanel>


回答1:


You declared the Label outside of StatusBar. A statusbar without Child cannot be seen, since the ActualHeight would be 0. To solve the problem, put the Label inside the StatusBar.

<DockPanel>
    <StatusBar DockPanel.Dock="Bottom">
        <Label>StatusBar Example</Label>
    </StatusBar>
</DockPanel>



回答2:


The StatusBar in your sample is empty and therefore has no height.

If you insert some content it should be displayed. For example:

<DockPanel>
    <StatusBar DockPanel.Dock="Bottom">
            <Label>Status Bar Text</Label>
    </StatusBar>
    <Label>StatusBar Example</Label>
</DockPanel>


来源:https://stackoverflow.com/questions/27351007/unable-to-see-status-bar

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!