Right click the control and click view code, the code editor will appear, and then implement the code as follow:
namespace WpfForExcel
{
/// <summary>
/// Interaction logic for UserControl1.xaml
/// </summary>
public partial class UserControl1 : UserControl
{
public UserControl1()
{
InitializeComponent();
}
StringBuilder oBuilder1;
StringBuilder oBuilder2;
string YougerthenHistory;
string DihyaHistory;
System.IO.StringWriter oWriter;
BitmapImage oBitmap;
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
//Inititalize the oWriter,oBuilder1,oBuilder2
oWriter = new System.IO.StringWriter();
oBuilder1 = new StringBuilder();
oBuilder2 = new StringBuilder();
}
/// <summary>
/// Void: This method fill the builder
/// </summary>
private void FillYougerthenHistory()
{
if (YougerthenHistory == "")
{
oBuilder1.AppendLine("Yougerthen, king of Numidia (113- 104 BCE).");
oBuilder1.AppendLine("Yougerthen was the grandson of King Massinissen,");
oBuilder1.AppendLine("after the death of King Micipsa in 118,");
oBuilder1.AppendLine("Numidia needed a new king.");
oBuilder1.AppendLine("Yougerthen used all his skills be the king");
oBuilder1.AppendLine("Meanwhile,responsibles in Rome was against that");
oBuilder1.AppendLine("Yougethen, who had bribed the Roman aristocracy");
oBuilder1.AppendLine("with loads of gold, went to Rome in full ");
oBuilder1.AppendLine("assurance that nothing would harm him. In ");
oBuilder1.AppendLine("front of the Senate, it was declared that he ");
oBuilder1.AppendLine("did not have to explain himself, and he could");
oBuilder1.AppendLine("return to Numidia.");
oBuilder1.AppendLine("He said Rome is a coutry for sale for anyone");
oBuilder1.AppendLine("pays the best prize. ");
oBuilder1.AppendLine("Finally, in 111, Rome decided to make");
oBuilder1.AppendLine("a war towards him to defend their position.");
oBuilder1.AppendLine("It soon escalated to war against Rome. Little ");
oBuilder1.AppendLine("was achieved by expose his weakness, and he ");
oBuilder1.AppendLine("used the desert and mountains to hide in or move through so ");
oBuilder1.AppendLine("that he always could get around the Roman troops.");
oBuilder1.AppendLine("Six legions are completly neutralized and destroyed");
oBuilder1.AppendLine("After years of humiliation, the Roman");
oBuilder1.AppendLine("commander Metellus was replaced by Marius. ");
oBuilder1.AppendLine("After _disibledevent="Verdana, Arial, Helvetica, sans-serif">Good Dotneting!!!