DockFill a Panel in the RibbonWindow!

Aug 18, 2012 at 6:07 AM
Edited Aug 18, 2012 at 6:09 AM

I am working on a New Project.

I have a Ribbon and a Status Bar in the Grid.

I want to DockFill a Panel in the RibbonWindow.

Meaning that the Panel will cover the whole area except the Ribbon and a StatusBar.

How can I accomplish that??

 

[An Approach]

I have tried it using the Margin property of the Panel, which works pretty well!

But, when the Ribbon gets collapsed I cannot fill the Panel to the Collapsed Ribbon area!

I have tried the following code in the "IsCollapsedChanged" Event but without any Luck.

private void RibbonCollapsed(object sender, DependencyPropertyChangedEventArgs e)
{
    DockPanel.Height = MyWindow.ActualHeight - (StatusStrip.ActualHeight + MyRibbon.ActualHeight);
}

Any Idea how to do it will also solve the problem.

 

Thanks,

WritZ

Aug 18, 2012 at 12:48 PM
Edited Aug 18, 2012 at 12:50 PM

Solved my own problem!

Used a DockPanel!

But seems that a new problem has arouse. A small gap is noticed between the panel and the ribbon when used in a dock panel!

Image

Is there a way to solve it??

Aug 18, 2012 at 4:37 PM

Did you include the ribbon inside of the dock control? Try that and set it to DockPanel.Dock="Top".

Aug 18, 2012 at 4:56 PM
AdamDavis wrote:

Did you include the ribbon inside of the dock control? Try that and set it to DockPanel.Dock="Top".

Yes.

Actually the Ribbon if not put inside the DockPanel, the DockPanel fills up the whole screen!

And if DockPanel.Dock="Top" is not set then the the Ribbon looks abnormally smaller in the Width than the Window!

So i have done those much before.

 

Moreover, The StatusBar.Dock="Bottom" is Set.

The Panel's Dock property is not set [as it is the LastChild in the context].

The Panel and the StatusBar both are in the DockPanel.

 

Thanks,

WritZ

Aug 18, 2012 at 5:16 PM

The way I've always done it is:

<DockPanel LastChild.Fill = "True">

<FluentRibbon DockPanel.Docvk="Top" />

<Panel DockPanel.Dock = "Left" />

<StatusBar DockPanel.Dock= "Bottom" />

<TabControl DockPanel.Dock = "Right" />

</DockPanel>

 

Basically like this. 

Since TabControl is the last child it fills whatever area is left.

Aug 18, 2012 at 5:35 PM
Edited Aug 18, 2012 at 5:36 PM
AdamDavis wrote:

The way I've always done it is:

<DockPanel LastChild.Fill = "True">

 <FluentRibbon DockPanel.Docvk="Top" />

<Panel DockPanel.Dock = "Left" />

<StatusBar DockPanel.Dock= "Bottom" />

<TabControl DockPanel.Dock = "Right" />

</DockPanel>

 

Basically like this. 

Since TabControl is the last child it fills whatever area is left.

Actually this is correct but If i specify the Dock to other controls except one ChildControl then the unDocked control is considered as the last ChildControl!

So, I  can do like this without any problem!

 

<DockPanel LastChildFill = "True">

    <Fluent:Ribbon DockPanel.Dock="Top" />

    <Panel>

    </Panel>

    <StatusBar DockPanel.Dock= "Bottom" />

</DockPanel>
Aug 19, 2012 at 2:56 AM

Yeah that's fine. I'm just saying that should get rid of the gap.

Aug 19, 2012 at 5:07 AM
AdamDavis wrote:

Yeah that's fine. I'm just saying that should get rid of the gap.

No, That doesn't get rid of the Gap!

Its still there!