Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Region inside Flyout not working #1020

Closed
pedromontemor opened this issue Feb 7, 2014 · 3 comments
Closed

Region inside Flyout not working #1020

pedromontemor opened this issue Feb 7, 2014 · 3 comments

Comments

@pedromontemor
Copy link

I have a region called "MenuRegion" that I want to add in a flyout. When I add this region inside MetroWindow.Content, that works fine, but inside FlyoutsControl or WindowCommands the RegionManager doesn't see my Region.

<mahapps:MetroWindow x:Class="SGD.Shell"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:cal="http://www.codeplex.com/prism" 
        xmlns:mahapps="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
        xmlns:local="clr-namespace:SGD"
        WindowStartupLocation="CenterScreen"
        GlowBrush="{DynamicResource AccentColorBrush}"
        Title="SGD" Height="600" Width="800">
    <mahapps:MetroWindow. Flyouts>
        <mahapps:FlyoutsControl>
            <mahapps:Flyout cal:RegionManager.RegionName="MenuRegion">

            </mahapps:Flyout>
        </mahapps:FlyoutsControl>
    </mahapps:MetroWindow.Flyouts>
    <mahapps:MetroWindow.Content>
        <mahapps:MetroContentControl>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <StackPanel Grid.Column="0" Background="Transparent" Width="8" MouseEnter="StackPanel_MouseEnter" HorizontalAlignment="Left">
                </StackPanel>

                <ContentControl cal:RegionManager.RegionName="WorkspaceRegion" Grid.Column="0" Grid.ColumnSpan="2" Margin="8,0,0,0"></ContentControl>
            </Grid>
        </mahapps:MetroContentControl>
    </mahapps:MetroWindow.Content>
</mahapps:MetroWindow>

MOD EDIT: @pedromontemor Please surround code in ```s. ~@Amrykid

@remcoros
Copy link
Contributor

Hey, I haven't used Prism myself, but it may be related to this: http://compositewpf.codeplex.com/discussions/213048

In short: because the flyouts control doesn't have a logical parent the region manager isn't able to find it.

I don't have a solution for you, but maybe this points you in the right direction.

@punker76 punker76 added this to the v0.14 milestone Mar 24, 2014
@glautrou
Copy link

glautrou commented Jun 1, 2014

Did you find a solution?

This is a workaround in your shell.xaml.cs file:
var regionManager = ServiceLocator.Current.GetInstance<IRegionManager>(); RegionManager.SetRegionManager(NameOfYourFlyoutControl, regionManager);

@flagbug flagbug removed this from the v0.14 milestone Aug 2, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

6 participants