I have a solution made of a project and a library
The library is a "WPF User Control Library" which holds a window called MegaBanner WF which is used as a MessageBox shaped in a better way.
When I build it I get no errors in regular files but two errors in the c:\development\easyrun\helperlib\obj\debug\views\megabannerwfwindow\megabannerwfwindow.g.i.cs file.
The problem is related with having the HelperNS prefix. In fact if I manually take it off the problem vanishes.
But that is not the right solution since that file is automatically generated and delete all the times.
The problem arises with ALL event added in the XAML file of the MegaBannerWF window.
<Base:WindowViewBase x:Class="HelperLib.MegaBannerWFWindowNS.MegaBannerWFWindow"
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"
mc:Ignorable="d"
xmlns:Base="clr-namespace:Cannoli.Base;assembly=Cannoli"
xmlns:design="clr-namespace:HelperLib.MegaBannerWFWindowNS.Design"
xmlns:fa="http://schemas.fontawesome.io/icons/"
WindowStartupLocation="CenterOwner"
ResizeMode="NoResize" WindowStyle="None" AllowsTransparency="True" Background="{x:Null}" WindowState="Maximized" ShowInTaskbar="False" KeyDown="WindowViewBase_KeyDown" >
<d:Window.DataContext>
<design:DesignMegaBannerWFWindowViewModel/>
<Grid Name="mainGrid" Height="200" Opacity="0.75" Background="Black">
<TextBlock Name="tbxBig" Text="---" HorizontalAlignment="Stretch" TextAlignment="Center" VerticalAlignment="Center" FontSize="26" Foreground="White" Height="50" Margin="10,47,10,108" Width="1000" />
<TextBlock Name="tbxBigUp" Text="---" HorizontalAlignment="Stretch" TextAlignment="Center" VerticalAlignment="Center" FontSize="26" Foreground="White" Height="50" Margin="2,16,10,139" Width="1000" />
<TextBlock x:Name="tbxSmall" Text="---" HorizontalAlignment="Stretch" VerticalAlignment="Center" FontSize="12" TextWrapping="Wrap" TextAlignment="Center" Foreground="White" Height="31" Margin="10,92,10,77" Width="1000" />
<StackPanel Name="spButtons" HorizontalAlignment="Center" VerticalAlignment="Bottom" Opacity="0.75" Margin="0,0,0,10" Orientation="Horizontal">
<Button x:Name="bt1" Content="1" Width="100" FontSize="16" Margin="10,10,10,10" Opacity="1" Click="Button_Click"/>
<Button x:Name="bt2" Content="2" Width="100" FontSize="16" Margin="10,10,10,10" Opacity="1" Click="Button_Click"/>
<Button x:Name="bt3" Content="3" Width="100" FontSize="16" Margin="10,10,10,10" Opacity="1" Click="Button_Click"/>
</StackPanel>
<ComboBox x:Name="cmbUser" HorizontalAlignment="Center" FontSize="16" Foreground="Black" HorizontalContentAlignment="Left" VerticalContentAlignment="Center" Margin="204,61,204,0" Background="Gainsboro" VerticalAlignment="Top" Height="30" Opacity="1" Width="200" BorderBrush="#FF0363EE" BorderThickness="5">
<ComboBox.ItemContainerStyle>
<Style TargetType="{x:Type ComboBoxItem}">
<Setter Property="Background" Value="Gainsboro" />
</Style>
</ComboBox.ItemContainerStyle>
</ComboBox>
<fa:ImageAwesome Name="imgWait" Icon="Spinner" Spin="True" SpinDuration="10" Width="100" Height="100" Foreground="Gainsboro" Margin="332,84,336,16"/>
<PasswordBox x:Name="pbxPassword" HorizontalAlignment="Center" Foreground="Black" FontSize="16" Margin="204,97,204,0" HorizontalContentAlignment="Left" Opacity="1" Background="Gainsboro" VerticalAlignment="Top" Height="30" Width="200"/>
So what I'd like to know is WHY there is this error in the .g.i.cs file when there are no error anywhere else.
As a workaround I have seen that if I put events anywhere else apart from the main window the problem doesn't arise. What I'd like to know is to catch keys in the window. This is easy by putting the key down event in the main window but that causes the problem. So I'd need to catch the key down event in its children (e.g. the maingrid) but if I put the key down event there it's not fired.
Thanx for any help
--ADD-- Here is the structure of my solution.
but what I'd like to understand is:
- WHY there's an error in g.i.cs file and nowhere else
- WHY it's related to events of the megabannerWF window only and not to it's children
alternatively
- How to catch key events from the mainWindow to its children.
Here above is my object browser structure. I think it's not different from what I have already shown before.