IsLightDismissEnabled="True" is not actually dismissing the popup - c#

i have a pop up and i want to close it when i tap anywhere outside the pop up. i searched and everyone advised me to use the property IsLightDismissEnabled; however if i touch outside, it will only remove the pop oup leaving everything inactive with a grey like screen as if it doesnt close the pop up completely
this is my code snippet:
<Popup x:Name="logincontroler" IsOpen="False" Margin="0,190,896,276" IsLightDismissEnabled="True">
<StackPanel Height="300" Width="470" x:Name="popup" FlowDirection="RightToLeft">
<Grid Width="470" Background="White" >
<Grid.RowDefinitions>
<RowDefinition Height="70"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<RichEditBox Grid.Row="1" Height="250" TextWrapping="Wrap" FontSize="20" Name="notesPopupTextBox" FlowDirection="LeftToRight"/>
<StackPanel Grid.Row="0" Orientation="Horizontal" Background="#FFE3E3E5">
<Button Name="CanclePopupButton" Content="Cancel" Width="64" Height="64" Click="CanclePopupButton_Click" />
<Button Name="ClearNotePopupButton" Content="Clear" Width="64" Height="64" Click="ClearNotePopupButton_Click" />
<Button Name="saveNoteButton" Content="Save" Width="64" Height="64" Click="saveNoteButton_Click" />
<TextBlock FontWeight="Medium" FontSize="40" Foreground="#2a2a86" Margin="170 12 0 0">Note</TextBlock>
</StackPanel>
</Grid>
</StackPanel>
</Popup>
this is my code for the events
private void ShowButton_Click(object sender, RoutedEventArgs e)
{
logincontroler.IsOpen = true;
flipView1.IsEnabled = false;
}
private void CanclePopupButton_Click(object sender, RoutedEventArgs e)
{
logincontroler.IsOpen = false;
flipView1.IsEnabled = true;
}
Am I missing anything?
thank you in advance

Are you sure you don't have some other code in the App that you are not showing us?
There should be no Gray box behind the Popup.
I have just tested your code on an empty Windows 8.1 (XAML+C#) App and it works fine.
Try creating and Blank Windows 8.1 App and make you MainPage like this:
MainPage.xaml
<Page
x:Class="App19.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App19"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
RequestedTheme="Light">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Popup x:Name="logincontroler" IsOpen="False" Margin="0,190,896,276" IsLightDismissEnabled="True">
<StackPanel Height="320" Width="470" x:Name="popup" FlowDirection="RightToLeft">
<Grid Width="470" Background="BurlyWood" >
<Grid.RowDefinitions>
<RowDefinition Height="70"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<RichEditBox Grid.Row="1" Height="250" TextWrapping="Wrap" FontSize="20" Name="notesPopupTextBox" FlowDirection="LeftToRight"/>
<StackPanel Grid.Row="0" Orientation="Horizontal" Background="#FFE3E3E5">
<Button Name="CanclePopupButton" Content="Cancel" Width="64" Height="64" />
<Button Name="ClearNotePopupButton" Content="Clear" Width="64" Height="64" />
<Button Name="saveNoteButton" Content="Save" Width="64" Height="64" />
<TextBlock FontWeight="Medium" FontSize="40" Foreground="#2a2a86" Margin="170 12 0 0">Note</TextBlock>
</StackPanel>
</Grid>
</StackPanel>
</Popup>
<Button Content="Show Popup" HorizontalAlignment="Left" Margin="692,260,0,0" VerticalAlignment="Top" Click="ShowButton_Click"/>
</Grid>
</Page>
MainPage.xaml.cs
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace App19
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
}
private void ShowButton_Click(object sender, RoutedEventArgs e)
{
logincontroler.IsOpen = true;
}
}
}
This has to work.
And comparing this with your solution should help you find the problem. If not, just edit your question with more information. (more code)
Note: I removed the click events from your popup, they were not needed to exemplify your problem, right?

Related

No overload for 'GameCanvas_Loaded' matches delegate 'RoutedEventHandler' and `PlayAgain_Click`

im doing a tetris game with a tutorial it works for him but not to for me idk what to do it does not work for me
<Window x:Class="tetris.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:local="clr-namespace:tetris"
mc:Ignorable="d"
Title="Tetris" Height="600" Width="800"
MinWidth = "600" MinHeight = "600"
Foreground = "White"
FontFamily="Segoe UI Light" FontSize="28"
KeyDown="Window_KeyDown">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.Background>
<ImageBrush ImageSource="Assets/Background.png"/>
</Grid.Background>
<Viewbox Grid.Row="1"
Grid.Column="1"
Margin="0,0,0,20">
<Canvas x:Name="GameCanvas"
Background="#101010"
Width="250"
Height="500"
ClipToBounds="True"
Loaded="GameCanvas_Loaded"/>
</Viewbox>
<TextBlock x:Name="SourceText"
Grid.Row="0"
Grid.Column="1"
Text="Score: "
Margin="0,10"
TextAlignment="Center"/>
<StackPanel Grid.Row="1"
Grid.Column="0"
VerticalAlignment="Center"
HorizontalAlignment="Right">
<TextBlock Text="Hold"
TextAlignment="Center"/>
<Image x:Name="HoldImage"
Margin="20"
Width="125"/>
</StackPanel>
<StackPanel Grid.Row="1"
Grid.Column="2"
VerticalAlignment="Center"
HorizontalAlignment="Left">
<TextBlock Text="Next"
TextAlignment="Center"/>
<Image x:Name="NextImage"
Margin="20"
Width="125"/>
</StackPanel>
<Grid x:Name="GameOverMenu"
Background="#cc000000"
Grid.RowSpan="2"
Grid.ColumnSpan="3"
Visibility="Hidden">
<StackPanel HorizontalAlignment="Center"
VerticalAlignment="Center">
<TextBlock Text="Game Over"
FontSize="48"
TextAlignment="Center"/>
<TextBlock x:Name="FinalScoreText"
Text="Score"
FontSize="36"
TextAlignment="Center"/>
<Button Content="PlayAgain"
Background="LightGreen"
Margin="0,20,0,0"
Padding="5"
Click="PlayAgain_Click"/>
</StackPanel>
</Grid>
</Grid>
</Window>
but they were not in the .cs file like = private void Window_KeyDown(object sender, KeyEventArgs e) i only have this one / but the guy in the tutorial had these two too=
private void GameCanvas_Loaded(object sender, KeyEventArgs e)
{
}
private void PlayAgain_Click(object sender, KeyEventArgs e)
{
} i added these two by my self but it did not work .
To subscribe an event (e.g., Loaded or Click), you handler (e.g., GameCanvas_Loaded) must match with the event's type. Both these events require the second parameter to be RoutedEventArgs. Check Loaded, Click. You usually don't need to write the handlers manually, if you write Load=" in your IDE, it will suggest creating a handler for you.
private void GameCanvas_Loaded(object sender, RoutedEventArgs e)
{
}
private void PlayAgain_Click(object sender, RoutedEventArgs e)
{
}

ContentDialog hidden behind soft keyboard UWP

I developed an UWP application that's having a wrong behavior on new version of Windows 10. In my application i have some ContentDialog with some TextBox inside them and when the soft-keyboard is shown it should push upwards the contentdialog but in new build of windows 10 this is not happening, anyone know why?
Here is a sample of my ContentDialog code:
<ContentDialog
x:Class="ManImp.CDEseguiOdM"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:ManImp"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
MaxHeight="{StaticResource ContentDialogMaxHeight}"
MaxWidth="{StaticResource ContentDialogMaxWidth}"
Margin="0"
Padding="0">
<Grid Background="{ThemeResource ApplicationBackGroudColor}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<!--0-->
<RowDefinition Height="Auto"></RowDefinition>
<!--0-->
<RowDefinition Height="Auto"></RowDefinition>
<!--1-->
<RowDefinition Height="Auto"></RowDefinition>
<!--2-->
<RowDefinition Height="Auto"></RowDefinition>
<!--3-->
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Vertical" x:Name="stckLabelFirma" Grid.Row="0" Grid.Column="0">
<TextBlock x:Name="lblFirma" VerticalAlignment="Center" TextWrapping="Wrap" FontSize="24" Foreground="White" FontWeight="Normal" HorizontalAlignment="Center" Margin="0,0,0,5"></TextBlock>
</StackPanel>
<StackPanel Orientation="Vertical" Grid.Row="1" Grid.Column="0">
<InkToolbar InitialControls="None" VerticalAlignment="Top" HorizontalAlignment="Right" TargetInkCanvas="{x:Bind inkCanvasFirma}" >
<InkToolbarEraserButton />
<InkToolbarBallpointPenButton />
</InkToolbar>
<Grid BorderBrush="Black" BorderThickness="1">
<Image Name="imgFirma" Stretch="Uniform"></Image>
<InkCanvas x:Name="inkCanvasFirma" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"></InkCanvas>
</Grid>
</StackPanel>
<StackPanel Orientation="Vertical" x:Name="stckDatiSupProd" Grid.Row="2" Grid.Column="0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<!--0-->
<ColumnDefinition Width="*"></ColumnDefinition>
<!--1-->
<ColumnDefinition Width="*"></ColumnDefinition>
<!--2-->
</Grid.ColumnDefinitions>
<StackPanel Orientation="Vertical" Grid.Column="0" Margin="0,10,5,0">
<TextBlock x:Name="lblCID" VerticalAlignment="Center" TextWrapping="Wrap" FontSize="20" Foreground="#FF034872" FontWeight="Bold" HorizontalAlignment="Left" Margin="0,0,0,0"></TextBlock>
<TextBox x:Name="txtCID" BorderBrush="Red" MaxLength="8" TextChanged="txtCID_TextChanged" VerticalAlignment="Center" Background="White" HorizontalAlignment="Stretch" Margin="0,10,0,0" TextWrapping="Wrap" FontSize="20"></TextBox>
</StackPanel>
<StackPanel Orientation="Vertical" Grid.Column="1" Margin="5,10,5,0">
<TextBlock x:Name="lblAlias" VerticalAlignment="Center" TextWrapping="Wrap" FontSize="20" Foreground="#FF034872" FontWeight="Bold" HorizontalAlignment="Left" Margin="0,0,0,0"></TextBlock>
<TextBox x:Name="txtAlias" BorderBrush="Red" TextChanged="txtAlias_TextChanged" VerticalAlignment="Center" Background="White" HorizontalAlignment="Stretch" Margin="0,10,0,0" TextWrapping="Wrap" FontSize="20"></TextBox>
</StackPanel>
<StackPanel Orientation="Vertical" Grid.Column="2" Margin="5,10,0,0">
<TextBlock x:Name="lblPIN" VerticalAlignment="Center" TextWrapping="Wrap" FontSize="20" Foreground="#FF034872" FontWeight="Bold" HorizontalAlignment="Left" Margin="0,0,0,0"></TextBlock>
<PasswordBox x:Name="txtPIN" BorderBrush="Red" PasswordChanged="txtPIN_PasswordChanged" VerticalAlignment="Center" Background="White" HorizontalAlignment="Stretch" Margin="0,10,0,0" FontSize="20"></PasswordBox>
</StackPanel>
</Grid>
</StackPanel>
<StackPanel Orientation="Vertical" Grid.Row="3" Grid.Column="0" Margin="0,10,0,0">
<TextBlock x:Name="lblErrore" Visibility="Collapsed" VerticalAlignment="Center" TextWrapping="Wrap" FontSize="14" Foreground="Red" FontWeight="Bold" HorizontalAlignment="Left" Margin="0,5,0,0"></TextBlock>
</StackPanel>
<StackPanel Orientation="Vertical" Grid.Row="4" Margin="0,10,0,0" Grid.Column="0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<!--0-->
<ColumnDefinition Width="*"></ColumnDefinition>
<!--1-->
</Grid.ColumnDefinitions>
<Button x:Name="btnAnnulla" Grid.Column="0" HorizontalAlignment="Stretch" Margin="0,30,10,0" VerticalAlignment="Top" Click="btnAnnulla_Click"></Button>
<Button x:Name="btnConfFirmaSupProd" Grid.Column="1" HorizontalAlignment="Stretch" Margin="10,30,0,0" VerticalAlignment="Top" Click="btnConfFirmaSupProd_Click"></Button>
<Button x:Name="btnConfFirmaOperatore" Grid.Column="1" HorizontalAlignment="Stretch" Margin="10,30,0,0" VerticalAlignment="Top" Click="btnConfFirmaOperatore_Click"></Button>
</Grid>
</StackPanel>
</Grid>
This should be an issue related to the old SDK that when the app is targeting old versions like 14393.
If you really want to achieve this behavior on all versions of Windows 10. I'd suggest you handle the showing and hiding events manually via InputPane.Showing Event and InputPane.Hiding Event. And then you might need to customize a PopUp control that looks like a ContentDialog. We can't change the position of the ContentDialog, because it is handled by the system. But we could change the position of a PopUp control.
When the on-screen keyboard is shown, the showing event will be fired and you could try to manually move your PopUp control upwards. When the keyboard is hidden, just move the PopUp control back to its original position.
Here is the sample code about how to handle the show and hide event:
protected override void OnNavigatedTo(NavigationEventArgs e)
{
InputPane currentInputPane = InputPane.GetForCurrentView();
// Subscribe to Showing/Hiding events
currentInputPane.Showing += OnShowing;
currentInputPane.Hiding += OnHiding;
}
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
InputPane currentInputPane = InputPane.GetForCurrentView();
// Unsubscribe from Showing/Hiding events
currentInputPane.Showing -= OnShowing;
currentInputPane.Hiding -= OnHiding;
}
void OnShowing(InputPane sender, InputPaneVisibilityEventArgs e)
{
//do something
}
void OnHiding(InputPane sender, InputPaneVisibilityEventArgs e)
{
//do something
}
You could also get information about the touch keyboard here: Respond to the presence of the touch keyboard

UWP Frame Navigation

I create my MainPage in xaml and it has a Frame that I replace its content navigating to another pages.
Here is my frame inside my MainPage:
<SplitView.Content>
<Frame x:Name="contentFrame" x:FieldModifier="public"/>
</SplitView.Content>
I my button click I change it content:
private void createResume_Click(object sender, RoutedEventArgs e)
{
contentFrame.Navigate(typeof(CreateResume));
}
Until now, it works perfect. And the frame content will have the CreateResume.xaml page:
<Grid Background="Black">
<Grid.RowDefinitions>
<RowDefinition Height="150"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Text="Full Name:" Foreground="White" FontSize="20" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="5" />
<TextBox Grid.Column="1" x:Name="fullName" PlaceholderText="Type your full name here" Width="250" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="5" />
<TextBlock Grid.Row="1" Text="Email:" Foreground="White" FontSize="20" HorizontalAlignment="Right" Margin="5" />
<TextBox Grid.Row="1" Grid.Column="1" x:Name="email" PlaceholderText="Type your email here" HorizontalAlignment="Left" Width="250" Margin="5" />
<TextBlock Grid.Row="2" Text="City:" Foreground="White" FontSize="20" HorizontalAlignment="Right" Margin="5" />
<TextBox Grid.Row="2" Grid.Column="1" x:Name="city" PlaceholderText="Type your city here" HorizontalAlignment="Left" Width="250" Margin="5" />
<TextBlock Grid.Row="3" Text="State:" Foreground="White" FontSize="20" HorizontalAlignment="Right" Margin="5" />
<TextBox Grid.Row="3" Grid.Column="1" x:Name="state" PlaceholderText="Type your state name here" HorizontalAlignment="Left" Width="250" Margin="5" />
<Button Grid.Row="4" Content="Save and Continue" Background="White" Foreground="DarkBlue" FontSize="20" HorizontalAlignment="Right" Click="Button_Click" />
</Grid>
Inside the CreateResume.xaml, I click on my button and I try to call another page to replace the frame content:
MainPage mainPage = new MainPage();
mainPage.contentFrame.Navigate(typeof(EducationInfo));
At this point I get an error: "An unhandled exception of type 'System.AccessViolationException' occurred"
I made the frame public, so why do I get the Access Violation Exception?
The mainPage is the new page but it dont show in Window.
If you want to Navigate to other page that you should talk to mainPage that you want to navigate and make the mainPage to navigate to other page.
The good way is use MVVM.
The first: you can bind MainPage to MainViewModel and the MainViewModel have to sub viewModel as CreateResumeViewModel and EducationInfoViewModel
I think you can write the ViewModel in the App.xaml
The code is in the App.xaml.Resource
<Application
x:Class="MehdiDiagram.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MehdiDiagram"
RequestedTheme="Light">
<Application.Resources>
<local:ViewModel x:Key="ViewModel"></local:ViewModel>
</Application.Resources>
</Application>
And you can bind the ViewModel to MainPage.
<Page
x:Class="MehdiDiagram.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MehdiDiagram"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
DataContext="{StaticResource ViewModel}"
mc:Ignorable="d">
And Bind the CreateResumeViewModel to CreateResume.
For ViewModel have two property that the one is CreateResumeViewModel.
Like the MainPage that you can bind the CreateResumeViewModel property to CreateResume.
DataContext="{Binding Source={StaticResource ViewModel},Path=CreateResumeViewModel}"
The CreateResumeViewModel have an event that call to Navigate to other page.
The ViewModel also have an event that call to Navigate to other page.
The code is in ViewModel:
class ViewModel
{
public ViewModel()
{
CreateResumeViewModel.NavigateToPage += (sender, type) =>
{
NavigateToPage?.Invoke(sender, type);
};
}
public event EventHandler<Type> NavigateToPage;
public CreateResumeViewModel CreateResumeViewModel{ get; set; }=new CreateResumeViewModel;
}
The code is in MainPage.
public MainPage()
{
this.InitializeComponent();
ViewModel = (ViewModel) DataContext;
ViewModel.NavigateToPage += ViewModel_NavigateToPage;
}
private void ViewModel_NavigateToPage(object sender, Type e)
{
Frame.Navigate(e);
}
You can use the NavigateToPage event in CreateResumeViewModel when it should navigate page.
See:https://github.com/lindexi/UWP/tree/master/uwp/src/Framework

Xaml nested event is not working

I have a grid with an tap event and in this grid three more buttons with click event. The first (the middle) button is working, but the others are not. If I click on it the grid event is fired instead of the button event. And i didn't know why?
<Page
....
<Grid Background="{ThemeResource BackgroundBrush}" Tapped="Grid_Tapped">
<Grid.RowDefinitions>
<RowDefinition Height="130"/>
<RowDefinition Height="80"/>
<RowDefinition Height="10"/>
<RowDefinition Height="*"/>
<RowDefinition Height="90"/>
</Grid.RowDefinitions>
<Border Grid.Row="2" Background="#BEBEBE"/>
<Border Grid.Row="3" Background="#BEBEBE"/>
....
<Button x:Name="btnGoToContent" Content="" HorizontalAlignment="Center" VerticalAlignment="Bottom" Grid.Row="3" Margin="0,0,0,20" Height="80" Width="320" Click="btnGoToContent_Click" Style="{StaticResource ButtonStyle2}" Opacity="0.7"/>
<Button x:Name="btnDiashowBack" Content="" HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Row="3" Margin="0,0,0,0" Height="220" Width="220" Click="btnDiashowBack_Click" Style="{StaticResource BackButtonStyle}" Opacity="0.7"/>
<Button x:Name="btnDiashowNext" Content="" HorizontalAlignment="Right" VerticalAlignment="Center" Grid.Row="3" Margin="0,0,0,0" Height="220" Width="220" Click="btnDiashowNext_Click" Style="{StaticResource BackButtonMirror}" Opacity="0.7"/>
</Grid>
I don't know why it isn't working. But I've solved it with this Workaround. Skip the event in the grid event handler
private async void Grid_Tapped(object sender, TappedRoutedEventArgs e) {
if (e.OriginalSource.GetType() == typeof(TextBlock))
{
return;
}
.......
}

WPF XAML Using Mouse Action Event

I am learning the WPF 4.5 Unleashed book. When I tried to incorporate Mouse Action Event such as MouseEnter or MouseDoubleClick for the Button by typing the code manually, the compiler told me it could not find the reference for the Mouse Action Event. However, when I use the double Tab shortcut, everything works well. What could possibly be the issue? I have bold the trouble code below.
<Window x:Class="WpfApplicationLearning0001.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="513.265" Width="748.469">
<DockPanel>
<Menu DockPanel.Dock="Top">
</Menu>
<StackPanel Name="ButtonBar" Orientation="Horizontal" DockPanel.Dock="Right">
<StackPanel.LayoutTransform>
<RotateTransform Angle="90">
</RotateTransform>
</StackPanel.LayoutTransform>
**<Button Name="Panel1Button" MouseEnter="Panel1Button_MouseEnter">
Toolbox
</Button>**
</StackPanel>
<Grid Background="White" Margin="0,0,2,3">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Background="Black" Foreground="White" HorizontalContentAlignment="Center" Content= "Start Page"/>
<GroupBox Grid.Row="1" Grid.Column="0" Background="White" Foreground="Black" Header="Start" />
<GroupBox Grid.Row="2" Grid.Column="0" Background="White" Foreground="Black" Header="Recent" />
<GroupBox Grid.Row="3" Grid.Column="0" Background="White" Foreground="Black" Header="Option" />
<GroupBox Grid.Row="1" Grid.Column="1" Grid.RowSpan="3" Background="White" Foreground="Black" Header="Get Start">
<ListBox>
<ListBoxItem>Article number1</ListBoxItem>
<ListBoxItem>Article number2</ListBoxItem>
<ListBoxItem>Article number3</ListBoxItem>
<ListBoxItem>Article number4</ListBoxItem>
</ListBox>
</GroupBox>
</Grid>
</DockPanel>
The double click not only puts it in the XAML code, put it also creates the code behind in the .cs file of:
private void Panel1Button_MouseEnter(object sender, MouseEventArgs e)
{
}
Until you add the code behind yourself, if you are doing it manually, then the error is correct. In addition, when manually coding be sure to include (object sender, MouseEventArgs e) in the function call or it may not recognize it as a valid function call to the MouseEvent.

Categories

Resources