开发者

WPF NavigationWindow and StatusBar

开发者_如何转开发

Is it possible to have a StatusBar in a WPF application that runs a NavigationWindow, other than by including it on each Page hosted by the navigation window?


Yes, overriding NavigationWindow template does the trick:

<NavigationWindow  x:Class="Test.NavWindow"
                   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                   Title="NavWindow">
    <NavigationWindow.Template>
        <ControlTemplate TargetType="NavigationWindow">
            <DockPanel Background="{TemplateBinding Background}">
                <Label Content="StatusBar..." 
                       Background="LightGray"
                       DockPanel.Dock="Bottom"/>
                <ContentPresenter Content="{TemplateBinding Content}"
                                  ContentTemplate="{TemplateBinding ContentTemplate}"/>
            </DockPanel>            
        </ControlTemplate>
    </NavigationWindow.Template>
</NavigationWindow >

It's just demonstration, usually you should perform better tweak of ControlTemplate, thank's god you could find a lot of examples over internet.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜