This program is being developed with Windows Presentation Foundation in C# using the Visual Studio IDE. Below is a screenshot with red comments. It’s from the Visual Studio IDE. Click on the thumbnail and it will enlarge.
Below is the XAML code. The interface all exists inside a StackPanel. There is a Label and then a Grid. I could have just put the first lable inside the Grid, but this works fine anyway.
One interesting part of the XAML code is the Buttons. We are not placing a graphic file on top of the buttons to produce the arrows. Instead we are using Shapes. Another interesting thing is the following code: PreviewKeyDown=”Window_PreviewKeyDown”. In the code behind, discussed in the post called Daily Thought C# Listing, we have code that captures the keys that the user types.
<Window x:Class="ThoughtForTheDay.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:ThoughtForTheDay"
mc:Ignorable="d"
PreviewKeyDown="Window_PreviewKeyDown"
Title="Thought for the Day" Height="600" Width="380" MinWidth="380">
<StackPanel Margin="0">
<Label Content="Thought for the Day" Margin="4" FontFamily="Ariel" FontSize="20" FontWeight="Bold"
FontStyle="Italic" HorizontalAlignment="Center"/>
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center"
Margin="60,5,50,5" Width="260">
<Button x:Name="btnBack" Click="BtnBack_Click" Margin="15,5,5,5" BorderThickness="0" Background="Transparent">
<Polygon Points="18,0 0,10 18,20" Fill="DarkSlateGray" />
</Button>
<Label x:Name="lblDate" FontSize="14" Margin="5,5,5,5.4" Width="139" VerticalAlignment="Center"
HorizontalAlignment="Center">September 12, 2020</Label>
<Button x:Name="btnForward" Click="BtnForward_Click" Margin="5,5,5,5" BorderThickness="0" Background="Transparent" >
<Polygon Points="0,0 18,10 0,20" Fill="DarkSlateGray" />
</Button>
<Label x:Name="lblDateCSharp" Visibility="Collapsed" Width="58">123</Label>
<Label x:Name="lblDateSQLite" Visibility="Collapsed" Width="58" Content="245"/>
</StackPanel>
<TextBlock x:Name="txtblkThought" Grid.Row="1" FontFamily="Segoe UI" FontSize="16" TextWrapping="Wrap" Margin="5,5,5,5">For God so loved the world, that he gave his only begotten Son, that whosoever... - John 3:16</TextBlock>
<TextBlock x:Name="txtblkExplanation" Grid.Row="2" FontSize="14" TextWrapping="Wrap" Margin="5,5,5,5">God loved the world of redeemable mankind so much that he gave his only begotten son, Jesus Christ...</TextBlock>
</Grid>
<StackPanel.Background>
<ImageBrush ImageSource="background3.png" Opacity="0.7"/>
</StackPanel.Background>
</StackPanel>
</Window>
