0

I have been using MahApp.Metro for a few project now, and WinForms charts too, and also combined them. So nothing new on that front in this project, except :

The placement of the chart. And this is causing an issue where the Mahapps.Metro Flyout menu i have opens BEHIND the chart. See Screenshot.

enter image description here

Is there any way to solve this? i have searched a bit and found nothing. In CSS it would be a simple z-index setting... but in C# i have no idea.

Any help appreciated.

XAML as requested :

<Controls:MetroWindow x:Name="wdw_MainWindow" x:Class="AdminProgram.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
    xmlns:winformchart="clr-namespace:System.Windows.Forms.DataVisualization.Charting;assembly=System.Windows.Forms.DataVisualization"
    xmlns:local="clr-namespace:AdminProgram"
    mc:Ignorable="d"
    Title="MainWindow" Height="600" Width="1024" GlowBrush="{DynamicResource AccentColorBrush}" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" BorderThickness="2,2,0,2" ShowMinButton="False" ShowMaxRestoreButton="False" IsMinButtonEnabled="False" IsMaxRestoreButtonEnabled="False" BorderBrush="#FF7C7C7C" TitleForeground="White">
<Controls:MetroWindow.Flyouts>
    <Controls:FlyoutsControl>
        <Controls:Flyout x:Name="fyo_Menu" Header="Menu" Width="200" Theme="Accent">
            <Grid>
                <Controls:Tile x:Name="btn_AddNew" Title="Add New" 
                Width="150" Height="150" TitleFontSize="20" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0" Click="btn_AddNew_Click" KeepDragging="False" MouseEnter="Tile_MouseEnter" MouseLeave="Tile_MouseLeave" BorderBrush="#FFC89632">
                </Controls:Tile>
                <Controls:Tile x:Name="btn_ViewAll" Title="View All" 
                Width="150" Height="150" TitleFontSize="20" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,160,0,0" Padding="0" Click="btn_ViewAll_Click" MouseEnter="Tile_MouseEnter" MouseLeave="Tile_MouseLeave" BorderBrush="#FFC89632" >
                </Controls:Tile>
            </Grid>
        </Controls:Flyout>
    </Controls:FlyoutsControl>
</Controls:MetroWindow.Flyouts>
<GroupBox x:Name="gpb_Home_Stats" Header="Latest information and statistics" Margin="0,50,0,0">
  <Grid>
    <!--- Winforms Integrated charting -->
    <!--Strength bars -->
    <WindowsFormsHost x:Name="wfh_Statistics_Strengthometer" VerticalAlignment="Center"  HorizontalAlignment="Center" Margin="0,0,0,0" Width="950" Height="425">
        <winformchart:Chart x:Name="chart_Strengthometer" Dock="None">
            <winformchart:Chart.Legends>
                <winformchart:Legend Docking="Left" TitleSeparator="Line" Title="Coffee count by strength"/>
            </winformchart:Chart.Legends>
            <winformchart:Chart.Series>
                <winformchart:Series Name="Strength" ChartType="Column"/>
            </winformchart:Chart.Series>
            <winformchart:Chart.ChartAreas>
                <winformchart:ChartArea/>
            </winformchart:Chart.ChartAreas>
        </winformchart:Chart>
    </WindowsFormsHost>
  </Grid>
</GroupBox>

Louis M.
  • 143
  • 13

1 Answers1

1

That's a known issue when mixing WinForms and WPF and is not related to MahApps.Metro. Just search for Airspace here at StackOverflow.

Community
  • 1
  • 1
Thomas Freudenberg
  • 5,048
  • 1
  • 35
  • 44