Status bar in a usercontrol

Docking/MDI for WPF Forum

Posted 15 years ago by Willie

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:x="" Width="300" Height="300">
        <StatusBar x:Name="MainStatusBar" Padding="0,0,0,0" HorizontalAlignment="Stretch" FocusManager.IsFocusScope="True">

Comments (3)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
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
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
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 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.