How can I create a ProgressBar and use an animation to simulate the progress of an operation ?

This example creates a ProgressBar and uses an ’animation’ to simulate the progress of an operation. [XAML] <StatusBar Name=’sbar’ VerticalAlignment=’Bottom’ Background=’Beige’ > <StatusBarItem> <TextBlock>Downloading File</TextBlock> </StatusBarItem> <StatusBarItem> <ProgressBar Width=’100′ Height=’20’ Name=’progressBar1′> <ProgressBar.Triggers> <EventTrigger RoutedEvent=’ProgressBar.Loaded’> <BeginStoryboard> <Storyboard> <DoubleAnimation Storyboard.TargetName=’progressBar1′ Storyboard.TargetProperty=’Value’ From=’0′ To=’100′ Duration=’0:0:5′ /> </Storyboard> </BeginStoryboard> </EventTrigger> </ProgressBar.Triggers> </ProgressBar> </StatusBarItem> <StatusBarItem> <Separator/> </StatusBarItem> <StatusBarItem> <TextBlock>Online</TextBlock> </StatusBarItem> <StatusBarItem HorizontalAlignment=’Right’> <Image Source=’images\help.bmp’ Width=’16’ Height=’16’/> </StatusBarItem> </StatusBar>

What is the use of x:code ?

x:Code is a directive element defined in XAML. An x:Code directive element can contain inline programming code. The code that is defined inline can interact with the XAML on the same page. The following example illustrates inline C# code. Notice that the code is inside the x:Code element and that the code must be surrounded by <CDATA[…]]> to escape the contents for XML, so that an XAML processor (interpreting either the XAML schema or the WPF schema) will not try to interpret the contents literally as XML. [XAML] <Page xmlns=’http://schemas.microsoft.com/winfx/2006/xaml/presentation’ xmlns:x=’http://schemas.microsoft.com/winfx/2006/xaml’ x:Class=’MyNamespace.MyCanvasCodeInline’ > <Button Name=’button1′ Click=’Clicked’>Click Me!</Button> <x:Code><![CDATA[ void Clicked(object sender, RoutedEventArgs e) { button1.Content = ‘Hello World’; } ]]></x:Code> </Page>

What are Attached Properties and how to register it?

An ‘attached’ property is a concept defined by Extensible Application Markup Language (XAML). It is intended to be used as a type of global property that can be set on any object. In Windows Presentation Foundation (WPF), attached properties are typically defined as specialized forms of dependency properties that do not have the conventional ‘wrapper’ property. This example shows how to ’register’ an attached property and provide public accessors so that you can use the property in both Extensible Application Markup Language (XAML) and code. Attached properties are a syntax concept defined by Extensible Application Markup Language (XAML). Most of the attached properties for WPF types are also implemented as dependency properties. You can use dependency properties on any ’DependencyObject’ types. [C#] public static readonly DependencyProperty IsBubbleSourceProperty = DependencyProperty.RegisterAttached( ‘IsBubbleSource’, typeof(Boolean), typeof(AquariumObject), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.AffectsRender) ); public static void SetIsBubbleSource(UIElement element, Boolean value) { element.SetValue(IsBubbleSourceProperty, value); } public static Boolean GetIsBubbleSource(UIElement element) { return (Boolean)element.GetValue(IsBubbleSourceProperty); }

How do I view the XAML resources compiled into an assembly in BAML format?

Embedded XAML Resources Several WPF assemblies come with embedded XAML resources, like template definitions, style definitions, etc. And it’s often very useful to take a look at these embedded XAML to understand the structure of a control and thereby making it easier to customize it’s UI in your applications, if necessary. The best way to take a look at these embedded XAML resources is to use the Reflector tool with the BAML Viewer plugin. Reflector + BAML Viewer Reflector is a popular Free tool available since the early days of .NET to help you take a deeper look at the source and resources comprising a .NET assembly. Reflector can be downloaded here: .NET Reflector Here is a thumbnail view of the Reflector tool: Once you install the Reflector, download the BAML Viewer plug-in from: BAML Viewer – Reflector Plugin The plug-in is a single dll called Reflector.BamlViewer.dll. Put this dll next to the Reflector.exe and follow these steps to add the plug-in to the Reflector: a) In the Reflector tool, select the View/Add Ins… menu item. b) In the ‘Add Ins’ dialog box, Add the above dll as an ‘add-in’. This will include a new ‘Tools/BAML Viewer’ menu item in the Reflector. c) Then open a WPF assembly (or Syncfusion assembly) that usually contains a BAML resource, like PresentationFramework.Aero.dll (usually found under ‘%ProgramFiles%\Reference Assemblies\Microsoft\Framework\v3.0\PresentationFramework.Aero.dll’) d) Then select the ‘Tools/BAML Viewer’ menu item. This will open a new ‘BAML Viewer’ view showing the embedded XAML in the above assembly. Here is a screenshot of the BAML Viewer showing the embedded XAML in the PresentationFramework.Aero.dll: You can similarly view XAML resources embedded into Syncfusion assemblies.