chris84948/AirspaceFixer

net 4.0 nuget wtf?

Closed this issue · 7 comments

To let you know if you're laying out on Nuget, it's a good idea to lay out the builds for all versions of the platform. After the installation on net 4.0, I stumbled with a non-working solution (

I compiled manually under 4.0. There are no errors, but it does not work in my project. I applied https://microsoftdwayneneed.codeplex.com/ and it works in the same place as your library. It is a pity to use their library, it has problems with the visual designer.

How are you using it? I just tested with building on .NET 4.0 and it's working as expected. Give me a code sample and I'll take a look at it.

i use with https://github.com/MahApps/MahApps.Metro, and right side flyout sinks on wf.
OK example is a bit later

OK, so it's working, I think you're just missing how the binding stuff all works.

Right now, you haven't got anything for the View to bind to, so the line copied from the sample saying
FixAirspace="{Binding FixAirspace}"
Doesn't have anywhere to go.

I'd recommend looking into some MVVM framework stuff to see how that all works, it's too complicated to explain here.

One thing you can do, just to get things working, is name the AirSpacePanel and the controls:Flyout object, so you can directly address them from the code behind. This way, you can set the FixAirspace property of the AirspacePanel directly and make sure it works.

I've attached the updated files for MainWindow.xaml and MainWindow.xaml.cs. Also, it doesn't look like you're doing anything in particular that can't use .NET 4.5, if you upgraded your project to 4.5, you could just use the AirspaceFixer Nuget package. That's totally your choice though.

        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:local="clr-namespace:WpfApplicationAirMyTest"
        xmlns:Controls="http://metro.mahapps.com/winfx/xaml/controls"
        xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
        xmlns:asf="clr-namespace:AirspaceFixer;assembly=AirspaceFixer"
        mc:Ignorable="d"
        Title="MainWindow" Height="350" Width="525">

    <Controls:MetroWindow.Flyouts>
        <Controls:FlyoutsControl x:Name="flyoutsControl">
            <Controls:Flyout x:Name="flyoutControl"
                             Header="FlyoutHeader"
                             Position="Right"
                             Theme="Dark">
                <Grid Margin="10"
                      Width="250">
                    <StackPanel>
                        <TextBlock Text="viberiOttenokOknaText" />
                        <StackPanel Orientation="Horizontal" Margin="10,20,0,0">
                            <ToggleButton x:Name="tbColor1" Background="#F2F2F2" Content="ToggleButton" HorizontalAlignment="Left" Height="50"  VerticalAlignment="Top" Width="50" />
                            <ToggleButton x:Name="tbColor2" Background="#D6DBE9" Margin="10,0,0,0" Content="ToggleButton" HorizontalAlignment="Left" Height="50"  VerticalAlignment="Top" Width="50"/>
                            <ToggleButton x:Name="tbColor3" Background="White" Margin="10,0,0,0" Content="ToggleButton" HorizontalAlignment="Left" Height="50"  VerticalAlignment="Top" Width="50" />

                        </StackPanel>
                        <TextBlock Text="viberiStatusBaraColor" Margin="0,20,0,0" />
                        <StackPanel Orientation="Horizontal" Margin="10,20,0,0">
                            <ToggleButton x:Name="tbSbColor1" Background="#0072C6" Content="ToggleButton" HorizontalAlignment="Left" Height="50"  VerticalAlignment="Top" Width="50" />
                            <ToggleButton x:Name="tbSbColor2" Background="#D24726" Margin="10,0,0,0" Content="ToggleButton" HorizontalAlignment="Left" Height="50"  VerticalAlignment="Top" Width="50" />
                            <ToggleButton x:Name="tbSbColor3" Background="#217346" Margin="10,0,0,0" Content="ToggleButton" HorizontalAlignment="Left" Height="50"  VerticalAlignment="Top" Width="50"/>

                        </StackPanel>

                        <TextBlock Text="Дополнительно" Margin="0,20,0,0" />
                        <Button x:Name="resetLayoutWindowButton" Content="resetLayoutWindowButton" HorizontalAlignment="Left" Margin="10,20,0,0" VerticalAlignment="Top" Width="180" Focusable="False"/>

                    </StackPanel>
                </Grid>
            </Controls:Flyout>
        </Controls:FlyoutsControl>
    </Controls:MetroWindow.Flyouts>

    
    <Grid>
        <StackPanel Orientation="Horizontal">
            <Button x:Name="button" Content="Button" Click="button_Click" HorizontalAlignment="Left"  VerticalAlignment="Top" Width="75"/>
            <asf:AirspacePanel x:Name="AirspacePanel">
                <WindowsFormsHost Background="Green" Width="544">
                    <wf:TreeView x:Name="tv1" BackColor="Green" />
                </WindowsFormsHost>
            </asf:AirspacePanel>
        </StackPanel>
    </Grid>
</Controls:MetroWindow>

public partial class MainWindow : MetroWindow
{
    public MainWindow()
    {
        InitializeComponent();
        //tv1.BackColor = Colors.Red;

        flyoutControl.ClosingFinished += (s, e) => AirspacePanel.FixAirspace = false;
    }

    private void button_Click(object sender, RoutedEventArgs e)
    {
        if (!flyoutControl.IsOpen)
        {
            AirspacePanel.FixAirspace = true;
            flyoutControl.IsOpen = true;
        }
        else
        {
            flyoutControl.IsOpen = false;                
        }
    }
}

Ooo really missed this point (now works) thanks
I need support WinXP, net 4.0 only