DESIGNING .NET 4
WINDOWS APPLICATIONS:
PRESENTATION LAYER

- RESPONSIVENESS

public delegate void SetTextDelegate(string t);

public void SetText(string t)

{

if (textBox1.InvokeRequired)

{

SetTextDelegate del = new SetTextDelegate(SetText);

this.Invoke(del, new object[]{t});

}

else

{

textBox1.Text = t;

}

}

System.Windows.Threading.Dispatcher dispatcher = button1.Dispatcher;

// Invoke synchronously.

dispatcher.Invoke(System.Windows.Threading.DuispatcherPriority.Normal, methodToCall);

// Invoke asynchronously.

dispatcher.BeginInvoke(System.Windows.Threading.DuispatcherPriority.Normal, methodToCall);

Timeline.DesiredFrameRateProperty.OverrideMetadata(

typeof(timeline),

new FrameworkPropertyMetadata { DefaultValue = 20 }

);

AVOIDING UI

MEMORY ISSUES

A memory leak may occur when you use data

binding in Windows Presentation Foundation

How much memory does

my .NET application use?