Status bar in a usercontrol

Docking/MDI for WPF Forum

Posted 15 years ago by Willie
Avatar
Hi,

I created a status bar, that i want to use in different ribbonwindows. I try to create a usercontrol and place the statusbar on this, but i get a message "the statusbar is not defined". What am i doing wrong? When i place this in a ribbon window, it works fine.

<UserControl x:Class="WpfStatusBar"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:docking="http://schemas.actiprosoftware.com/winfx/xaml/docking"
    xmlns:ribbon="http://schemas.actiprosoftware.com/winfx/xaml/ribbon"
    xmlns:shared="http://schemas.actiprosoftware.com/winfx/xaml/shared"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="300" Height="300">
    <ribbon:RibbonWindow.StatusBar>
        <StatusBar x:Name="MainStatusBar" Padding="0,0,0,0" HorizontalAlignment="Stretch" FocusManager.IsFocusScope="True">
        </StatusBar>
    </ribbon:RibbonWindow.StatusBar>
</UserControl>

Comments (3)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Willie,

That is invalid syntax. You can only specify a property like that if the parent control is a ribbon:RibbonWindow, not a UserControl. Please review the Microsoft guidelines on XAML syntax, since those will help you with things like this. There isn't a way in XAML you can set a property like this onto a parent RibbonWindow from within a UserControl.


Actipro Software Support

Posted 15 years ago by Willie
Avatar
ok, thanks.

so the only way would be to create a ribbonwindow with a statusbar, and inherit from this window.
Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
That is one way to do it, yes.

Another way is to do something programmatically... like when the UserControl is inserted into a parent, programmatically add a StatusBar to the parent RibbonWindow. However you'd have to test theme changes, and when new templates are applied since that may trigger your code more than once and cause issues.

Just remember, you can never modify parent controls from within a UserControl's XAML like you were trying to do.


Actipro Software Support

The latest build of this product (v24.1.2) was released 2 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.