Silverlight 4 Security Overview White Paper

I came through a wonderful link that focuses on Security with Silverlight 3 and Silverlight 4 applications.  Kudos to Nick, who has explained this wonderfully…

For all my readers, do read this post… Its wonderful!

@Nick: Thanks man!

Link: http://blogs.msdn.com/nickkramer/archive/2009/11/20/silverlight-4-security-overview-white-paper.aspx

Continue reading » · Rating: · Written on: 12-28-09 · 2 Comments »

RichTextBox in Silverlight 4

I was trying my hands on Silverlight 4 Beta version and found this is wonderful control – RichTextBox.. This was much needed on Web Platform and Microsoft has really made it work simple… Rather, thanks to the invention of XAML!

This small control supports many features. Some of them are:

  • Formatting of text at runtime – font, color, bold, italics, underline, etc.
  • Addition of inline UI Elements in the Text Box itself.
  • Read / Write only modes both supported.
  • Hyperlinks can also be inserted in the text.

Let’s do some scripting. Two ways to work:-

Way 1: Texting through XAML

</div>
<div id="_mcePaste" style="text-decoration: underline; position: absolute; left: -10000px; top: 142px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><RichTextArea VerticalScrollBarVisibility="Auto" x:Name="richTextBox"></div>
<div id="_mcePaste" style="text-decoration: underline; position: absolute; left: -10000px; top: 142px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"><Paragraph> This is a <Bold>sample</Bold> text. </Paragraph></div>
<div id="_mcePaste" style="text-decoration: underline; position: absolute; left: -10000px; top: 142px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;"></RichTextArea></div>
<div id="_mcePaste" style="text-decoration: underline; position: absolute; left: -10000px; top: 142px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">

<RichTextArea VerticalScrollBarVisibility="Auto" x:Name="richTextBox">

<Paragraph> This is a <Bold>sample</Bold> text. </Paragraph>

</RichTextArea>

Way 2: Texting through C# Code


// Create a Run of plain text and some bold text.

Run myRun1 = new Run();

myRun1.Text = "This is a ";

Bold myBold = new Bold();

myBold.Inlines.Add("sample");

Run myRun2 = new Run();

myRun2.Text = "text.";

// Create a paragraph and add the Run and Bold to it.

Paragraph myParagraph = new Paragraph();

myParagraph.Inlines.Add(myRun1);

myParagraph.Inlines.Add(myBold);

myParagraph.Inlines.Add(myRun2);

// Add the paragraph to the RichTextArea.

richTextBox.Blocks.Add(myParagraph);

//Add the RichTextArea to the StackPanel.

stackPanel.Children.Add(richTextBox);

Hope this helps!

Continue reading » · Rating: · Written on: 12-24-09 · 1 Comment »