From 285167c141ebd974318e41e148a693c5625e6ae8 Mon Sep 17 00:00:00 2001 From: marcusferl Date: Mon, 4 Apr 2022 21:08:20 +0200 Subject: [PATCH] update --- Test_App/App.xaml | 1 + Test_App/Style/Custom_window.xaml | 17 +++++++++++++++++ Test_App/Test_App.csproj | 5 ++++- Test_App/Views/Database.xaml | 10 +++++----- Test_App/Views/Database.xaml.cs | 28 ++++++++++++++++++++++++++++ 5 files changed, 55 insertions(+), 6 deletions(-) create mode 100644 Test_App/Style/Custom_window.xaml diff --git a/Test_App/App.xaml b/Test_App/App.xaml index dee3807..26560e9 100644 --- a/Test_App/App.xaml +++ b/Test_App/App.xaml @@ -8,6 +8,7 @@ + diff --git a/Test_App/Style/Custom_window.xaml b/Test_App/Style/Custom_window.xaml new file mode 100644 index 0000000..a837212 --- /dev/null +++ b/Test_App/Style/Custom_window.xaml @@ -0,0 +1,17 @@ + + + \ No newline at end of file diff --git a/Test_App/Test_App.csproj b/Test_App/Test_App.csproj index ef4657a..73d2fa9 100644 --- a/Test_App/Test_App.csproj +++ b/Test_App/Test_App.csproj @@ -86,6 +86,10 @@ MainWindow.xaml Code + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -138,7 +142,6 @@ SettingsSingleFileGenerator Settings.Designer.cs - diff --git a/Test_App/Views/Database.xaml b/Test_App/Views/Database.xaml index 98c596d..ebada33 100644 --- a/Test_App/Views/Database.xaml +++ b/Test_App/Views/Database.xaml @@ -7,9 +7,9 @@ mc:Ignorable="d" d:DesignHeight="525" d:DesignWidth="602"> - + + Padding="5" Margin="5" Background="WhiteSmoke" Width="700" MouseEnter="border_MouseEnter" MouseLeave="border_MouseLeave" CornerRadius="10,10,10,10"> @@ -27,7 +27,7 @@ - + @@ -35,12 +35,12 @@ - diff --git a/Test_App/Views/Database.xaml.cs b/Test_App/Views/Database.xaml.cs index 81e645a..6cdacad 100644 --- a/Test_App/Views/Database.xaml.cs +++ b/Test_App/Views/Database.xaml.cs @@ -47,7 +47,35 @@ namespace Test_App.Views datalist.ItemsSource = Newtonsoft.Json.JsonConvert.DeserializeObject>(json); } + private void border_MouseEnter(object sender, MouseEventArgs e) + { + Border border = sender as Border; + border.Background = new SolidColorBrush(Colors.LightGray); + } + + private void border_MouseLeave(object sender, MouseEventArgs e) + { + Border border = sender as Border; + border.Background = new SolidColorBrush(Colors.WhiteSmoke); + } + + private void itemOnClick(object sender, MouseButtonEventArgs e) + { + Ressources.Datas current = datalist.SelectedItem as Ressources.Datas; + + TextBox textBox = new TextBox(); + textBox.Style = (Style)FindResource("Custom_Window"); + textBox.Text = "Antwort: \n" + current.Answer + "\n"; + + Window window = new Window(); + window.Width = 550; + window.Height = 300; + window.SizeToContent = SizeToContent.WidthAndHeight; + window.Content = textBox; + window.Show(); + } } } +