100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
.NET

Silverlight Quick Reference

A condensed reference covering Silverlight's core XAML syntax, binding modes, threading rules, and networking essentials for fast lookup.

Practical SilverlightBeginner8 min readJul 10, 2026
Analogies

Silverlight Quick Reference

This reference condenses the syntax and rules a Silverlight developer looks up most often: core XAML layout elements, the data binding syntax and modes, the threading rule that governs every UI update, and the essential networking classes. It is meant as a fast lookup rather than a tutorial, assuming familiarity with the concepts covered in more depth elsewhere.

🏏

Cricket analogy: A fielding position cheat sheet pinned in the dressing room lets a captain make quick calls without re-deriving field theory each time, similar to this quick reference letting a developer look up Silverlight syntax fast.

XAML Layout Essentials

The core Silverlight layout panels are Grid (row/column layout via RowDefinitions and ColumnDefinitions), StackPanel (single-direction stacking via Orientation), Canvas (absolute positioning via Canvas.Left/Canvas.Top), and Border (a single-child decorator for background, border, and padding). Grid is the default choice for most real layouts because it resizes gracefully with the window, while Canvas should be reserved for cases needing pixel-precise absolute placement, such as custom drawing surfaces.

🏏

Cricket analogy: A well-marked cricket ground with defined zones for boundary, thirty-yard circle, and pitch resizes conceptually to any stadium size, similar to how Grid layout resizes gracefully compared to Canvas's fixed pixel placement.

Data Binding and Threading Cheat Sheet

Binding syntax is {Binding PropertyName, Mode=TwoWay, Converter={StaticResource MyConverter}}; the source object comes from DataContext unless ElementName or RelativeSource is specified instead. Every binding source class should implement INotifyPropertyChanged and raise PropertyChanged in every property setter. On the threading side, remember one absolute rule: only the UI thread may touch a UI element's properties, and any code running in a callback from WebClient, a background Thread, a Timer, or a Task must call Dispatcher.BeginInvoke to update the UI safely.

🏏

Cricket analogy: A clear team communication protocol where only the captain radios instructions to the field mirrors the strict rule that only the UI thread may update controls directly.

xml
<StackPanel Orientation="Vertical" DataContext="{Binding Path=SelectedItem, ElementName=ItemsList}">
    <TextBlock Text="{Binding Name}" />
    <TextBox Text="{Binding Price, Mode=TwoWay, Converter={StaticResource CurrencyConverter}}" />
    <ProgressBar Value="{Binding LoadPercent, Mode=OneWay}" Maximum="100" />
</StackPanel>

Quick threading rule: if the code is running inside a *Completed event handler, a BackgroundWorker.DoWork delegate, a System.Threading.Timer callback, or any manually created Thread, wrap the UI-touching line in Dispatcher.BeginInvoke(() => { ... });.

Networking and Storage Cheat Sheet

For simple HTTP calls, use WebClient.DownloadStringAsync / UploadStringAsync paired with their *Completed events; for more control over headers and streaming, use HttpWebRequest.BeginGetResponse. For structured service calls, add a Service Reference to generate an async WCF proxy. Any call to a domain other than the one hosting the .xap requires a clientaccesspolicy.xml on the target server. For local persistence, use IsolatedStorageSettings.ApplicationSettings for simple key-value data or an IsolatedStorageFile stream for larger structured data, keeping the default 1 MB quota in mind.

🏏

Cricket analogy: Choosing a quick single for a simple run versus calling for a risky two mirrors choosing WebClient for simple calls versus HttpWebRequest for finer control over the exchange.

IsolatedStorageSettings.ApplicationSettings is convenient but not free of cost: every write serializes the entire settings dictionary. For frequently changing or large data, use an IsolatedStorageFile stream instead, and always check remaining quota with IsolatedStorageFile.AvailableFreeSpace before large writes.

  • Grid is the default flexible layout panel; Canvas is for pixel-precise absolute positioning only.
  • Binding syntax is {Binding Path, Mode=..., Converter={StaticResource ...}}; source classes need INotifyPropertyChanged.
  • Only the UI thread may touch UI element properties; all other threads must use Dispatcher.BeginInvoke.
  • WebClient is the simplest async HTTP option; HttpWebRequest offers finer control over headers and streaming.
  • WCF service references generate async-only proxy methods for structured backend calls.
  • Cross-domain calls require a clientaccesspolicy.xml hosted on the target server.
  • IsolatedStorageSettings.ApplicationSettings suits small key-value data; use IsolatedStorageFile streams for larger data, respecting the 1 MB default quota.

Practice what you learned

Was this page helpful?

Topics covered

#NET#SilverlightStudyNotes#MicrosoftTechnologies#SilverlightQuickReference#Silverlight#Quick#Reference#XAML#StudyNotes#SkillVeris