fluentribbon / Fluent.Ribbon

WPF Ribbon control like in Office
http://fluentribbon.github.io
MIT License
2.55k stars 517 forks source link

Show Fluent.Ribbon StartScreen programmatically #1064

Closed Smallbasic-n closed 2 years ago

Smallbasic-n commented 2 years ago

I want to show Fluent.Ribbon StartScreen from program side.

So,I wrote this code. Constructor

    Public Sub New()
        InitializeComponent()
        RibbonGrid.StartScreen.CanChangeIsOpen = True
    End Sub

Show medhot

 RibbonGrid.StartScreen.IsOpen = True
 RibbonGrid.StartScreen.Shown = True

But, this code didn't work. So,please tell me best medhot.


Environment

batzen commented 2 years ago

It works like that in the showcase application. The showcase application does

this.startScreen.Shown = false;
this.startScreen.IsOpen = true;

Could you try that and attach a small repro if it does not work for you?

Smallbasic-n commented 2 years ago

Thank you for writeing comment. I tried that code, but it didn't work. Tried code is

Me.StartScreens.Shown = False
Me.StartScreens.IsOpen = True

and XAML

<Fluent:Ribbon.StartScreen>
    <Fluent:StartScreen x:Name="StartScreens" IsOpen="True" >
        <Fluent:StartScreenTabControl x:Name="StartScreens_Tab" >
            <Fluent:StartScreenTabControl.LeftContent>
                <StackPanel x:Name="StartScreens_Tab_Left_Stack" Orientation="Vertical" >
                    <Button x:Name="StartScreens_Tab_Left_Stack_AnyButton" Click="StartScreens_Tab_Left_Stack_AnyButton_Click" Content="Click me" />
                </StackPanel>
            </Fluent:StartScreenTabControl.LeftContent>
        </Fluent:StartScreenTabControl>
    </Fluent:StartScreen>
</Fluent:Ribbon.StartScreen>

What should I do?

batzen commented 2 years ago

Could you attach your complete sample project? The way i described works perfectly fine in the showcase application.

Smallbasic-n commented 2 years ago

I tried your code in the showcase application, it worked. When I change IsOpen property to True in my project, it didn't work. It couldn't open startscreen by programmatically. When I change IsOpen property to False in my project, it worked. I found its reason. My code is replace window content. Window content includes Fulent.Ribbon. So I deleted that code. before code

Dim Ribbon=Me.Content
Me.Content=New message()
Thread.Sleep(10000)
Me.Content=Ribbon

I deleted that code,and rewrite by way of other.

Thank you very match @batzen !

batzen commented 2 years ago

Glad I could help.