update
This commit is contained in:
parent
72e3991ff3
commit
285167c141
|
@ -8,6 +8,7 @@
|
|||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="Style/Menu_Button_Style.xaml"/>
|
||||
<ResourceDictionary Source="Style/Textbox_Style.xaml"/>
|
||||
<ResourceDictionary Source="Style/Custom_window.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
|
|
17
Test_App/Style/Custom_window.xaml
Normal file
17
Test_App/Style/Custom_window.xaml
Normal file
|
@ -0,0 +1,17 @@
|
|||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Style BasedOn="{StaticResource {x:Type TextBox}}"
|
||||
TargetType="{x:Type TextBox}"
|
||||
x:Key="Custom_Window">
|
||||
<Setter Property="Background" Value="#232041"/>
|
||||
<Setter Property="FontSize" Value="22"/>
|
||||
<Setter Property="FontFamily" Value="Tw Cen MT"/>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
<Setter Property="Width" Value="430"/>
|
||||
<Setter Property="VerticalAlignment" Value="Stretch"/>
|
||||
<Setter Property="TextWrapping" Value="Wrap"/>
|
||||
<Setter Property="TextWrapping" Value="Wrap"/>
|
||||
<Setter Property="TextAlignment" Value="Center"/>
|
||||
|
||||
</Style>
|
||||
</ResourceDictionary>
|
|
@ -86,6 +86,10 @@
|
|||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Page Include="Style\Custom_window.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Style\Textbox_Style.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
@ -138,7 +142,6 @@
|
|||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Include="Ressources\Students.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
mc:Ignorable="d"
|
||||
d:DesignHeight="525" d:DesignWidth="602">
|
||||
<Page.Resources>
|
||||
<DataTemplate x:Key="datas">
|
||||
<DataTemplate x:Key="datas" >
|
||||
<Border Name="border" BorderBrush="DarkSlateBlue" BorderThickness="2"
|
||||
CornerRadius="2" Padding="5" Margin="5" Background="WhiteSmoke">
|
||||
Padding="5" Margin="5" Background="WhiteSmoke" Width="700" MouseEnter="border_MouseEnter" MouseLeave="border_MouseLeave" CornerRadius="10,10,10,10">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
|
@ -27,7 +27,7 @@
|
|||
<TextBlock Grid.Row="1" Grid.Column="0" Padding="0,0,5,0" Text="Question: "/>
|
||||
<TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding Path=Question}"/>
|
||||
<TextBlock Grid.Row="2" Grid.Column="0" Padding="0,0,5,0" Text="Answer:"/>
|
||||
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding Path=Answer}"/>
|
||||
<TextBlock Name="answer_id" Grid.Row="2" Grid.Column="1" Text="{Binding Path=Answer}"/>
|
||||
|
||||
</Grid>
|
||||
</Border>
|
||||
|
@ -35,12 +35,12 @@
|
|||
</Page.Resources>
|
||||
|
||||
<DockPanel>
|
||||
<Label DockPanel.Dock="Top" FontSize="20" Margin="5" Content="Database"/>
|
||||
<ListBox x:Name="datalist"
|
||||
Background="#232041"
|
||||
ItemsSource="{Binding}"
|
||||
ItemTemplate="{StaticResource datas}"
|
||||
HorizontalAlignment="Stretch"
|
||||
IsSynchronizedWithCurrentItem="True"
|
||||
Margin="5,0,5,5" />
|
||||
Margin="5,0,5,5" Width="750" MouseDoubleClick="itemOnClick"/>
|
||||
</DockPanel>
|
||||
</Page>
|
||||
|
|
|
@ -47,7 +47,35 @@ namespace Test_App.Views
|
|||
datalist.ItemsSource = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Ressources.Datas>>(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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user