With the current article I will show you how to create a simple application, presenting yourself. The most of the application is created in XAML. Roughly, it looks like this:
The text is from here. This application is really easy for creation, as far as most of the job is already done within the engine of XAML, using the tags “FlowDocumentReader” and “FlowDocument”. With these tags you get the nice search options, the scroller and the different views. So, the only thing left is to set the paragraphs and to edit the text a little as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
<Window x:Class="FlowParagraph.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Vitosh Doynov" Height="500" Width="800" KeyDown="Window_KeyDown"> <FlowDocumentReader ViewingMode="Scroll"> <FlowDocument x:Name="fd" FontSize="12"> <Paragraph TextAlignment="Center" FontSize="14pt"> Vitosh Doynov </Paragraph> <Paragraph FontFamily="Courier" Background="LightCyan"> I started my first job in a warehouse in Sofia, Bulgaria, when I was 19. There I understood the basics of the logistics “from within”. After spending more than a year there, I have switched position to a call centre company, providing software live support. There, I have learnt how to provide outstanding customer satisfaction through achieving always better performance than the one in the SLAs. In my third job, as a junior consultant in the leading Greek consultancy company for supply chain and logistics, I have learnt to think as a consultant for the two logistics projects, in which I participated. In that position, I was part of a team, defining, measuring and improving business performance. Due to the crisis in Greece, the company has closed its Bulgarian office and I found a job as a translator in a Bulgarian construction company, operating in Greece. After two months, I was promoted to project manager and I was responsible for a small team of 8 Bulgarian workers. Furthermore, for 1 year, I was the contact person for the company in Greece, handling all the administrative functions of the branch. After the termination of the project, I have looked for an opportunity to develop my education further. </Paragraph> <Paragraph BorderBrush="Black" BorderThickness="2" FontFamily="Courier" TextIndent="40" Padding="5"> It may seem strange, that I have so much working experience, but I have also combined it with my education – I was always studying and working together. I am a holder of bachelor degree in Greek philology and a master degree in Business Administration – Strategic Management, profile Marketing. Both degrees are from the oldest University in Bulgaria – the University of Sofia. Currently, I am pursuing a degree in Business Administration – Supply Chain and Operations from the University of Groningen, the Netherlands. I have passed all my courses successfully and I have to write my master thesis with a subject “Stakeholder analysis in capacity management” in order to obtain my second master degree in business. As a part of my education, I have decided to do a 6-month internship at the corporate supply chain department of Metro AG in Dusseldorf. My internship has ended on 23 January 2013. </Paragraph> </FlowDocument> </FlowDocumentReader> </Window> |
And that is it. In order to make it fancier, we may assign some actions to the buttons as follows:
> if a button “N” is pressed, you will get the following message, added to the text: “Please, visit my site: www.vitoshacademy.com & like it in google :)”.
> if a button “A” is pressed, you get the following at the end of the first paragraph: “You may add text here as well :)”
This is the C# code, which makes these two functions:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace FlowParagraph { public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private void Window_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.N) fd.Blocks.Add(new Paragraph(new Run("Please, visit my site: www.vitoshacademy.com & like it in google :) "))); else if (e.Key == Key.A) { Paragraph p = fd.Blocks.ElementAt(1) as Paragraph; p.Inlines.Add(new Run(" You may add text here as well :)")); } } } } |
Last but not least, if you want to take a look at the application without messing with the code, you may take a look from here.
Enjoy it!