WinRT XAML Toolkit v1.2 for Windows 8 RTM - One Library, tons of features...
In out WinRT Wednesday post we're featuring a toolkit to help you build your apps faster, letting you focus on adding cool features and not worrying about plumbing. We're talking one official boat load of cool features, controls and capabilities... Free!
A set of controls, extensions and helper classes for Windows Runtime XAML applications.
This project is not managed by Microsoft. Its coordinator is currently not employed or sponsored by Microsoft. It is not a port of the Silverlight Toolkit, though it might get there at some point. This does not diminish the value of the code that is part of it and that you are free to use.
- Integrated extensions from the AsyncUI library- a set of extension methods for UI classes that add support for async/await to wait for events such as:
- Wait for a BitmapImage to load
- Wait for a Button or one of a list of buttons to be clicked
- Wait for a FrameworkElement to load, unload or become non-zero-sized
- Wait for a MediaElement to change state - eg. to start or finish playback
- Wait for a Selector (e.g. ListBox) to change selected item
- Wait for a Storyboard to complete
- Wait for a VisualState transition to complete
- Wait for a WebView to complete navigation
- Wait for a WriteableBitmap to load (uses polling due to lack of an event)
- AnimatingContainer - a container control that will animate its contents rotating or zooming in/out, eg. to make them feel more alive.
- CameraCaptureControl - supports displaying camera preview, capturing photos and videos, cycling between existing video capture devices, setting preference to Front/Back panel camera, etc.
- CascadingTextBlock - a TextBlock replacement that animates the individual letters in a cascade - fading in while falling down into position, then optionally fading out while falling down from the standard position.
- CountdownControl - a movie-style control that animates a ring-slice shape while counting down seconds - e.g. to take a picture with a camera after a given number of seconds (supports async/await).
- CustomAppBar - a custom implementation of the AppBar that automatically handles the three gestures to switch IsOpen (WinKey+Z, Right-Click, EdgeGesture), adds a CanOpen property, so you can prevent it from opening and opens/hides with a sliding animation when placed anywhere in the app, so you can layer content on top of it. Also features CanDismiss property to force the app bar to stay open in some situations, CanOpenInSnappedView which allows to block the app bar from showing up when the app is in the snapped view.
- CustomGridSplitter - a custom implementation of a GridSplitter as a templated control.
- DelayedLoadControl - given a content/DataTemplate - loads the contents after a given amount of time - e.g. to allow for staged loading of contents on screen.
- ImageButton - a custom Button control that takes one to three images to be used to represent different states of the button (normal/hover/pressed/disabled) as well as ways for the button to render all 4 states with just one or two images.
- ImageToggleButton - custom ToggleButton control, that like ImageButton - helps create buttons based on button state images using from 1 to 8 different state images and generating other state images with some simple image processing.
- InputDialog - a custom/templated dialog control that takes text input.
- ListItemButton - a simple button control with Click event and Command property to be used inside of list controls (the standard button steals pointer capture from the List/Grid~Items so they can't be selected.
- NumericUpDown - allows to display and manipulate a number using text input, +/- buttons or Blend-like swipe-manipulations
- PieSlice - a pie slice path/shape given StartAngle, EndAngle and Radius.
- RingSlice - a pie slice path/shape given StartAngle, EndAngle, Radius and InnerRadius.
- WatermarkTextBox - TextBox control with a watermark. Set WatermarkText to change the watermark prompt, change WatermarkStyle to change the style of the watermark TextBlock.
- WebBrowser - a templated control with a WebView + address bar, title bar, backstack navigation, favicon. work in progress (visual states are a bit messed up), but might be helpful as a starting point
- AnimationHelper - two attached properties - Storyboard and IsPlaying. Allows to easily control Storyboard playback from a view model (note limitation - a single storyboard per control).
- AppBarExtensions.HideWhenSnapped - allows to make the AppBar automatically hide when the app goes to the snapped view.
- ContentControlExtensions.FadeTransitioningContentTemplate - allows to change content template with a fade out/fade in transition.
- ControlExtensions.Cursor - enables setting a mouse cursor to show when hovering over a control.
- ImageExtensions.FadeInOnLoaded/.Source - allows to specify an image source such that the image fades in smoothly when the image source is loaded.
- ListBoxExtensions./ListViewExtensions.BindableSelection - allows a two-way binding of the SelectedItems collection on the Selector/list controls.
- RichTextBlockExtensions.PlainText - attached property that allows to easily single-way-bind plain text to a RichTextBlock (not really that useful other than for visualizing RichTextBlock styles in the sample app provided).
- TextBlockExtensions/GetCharacterRect() - an extension method that returns a rectangle that holds a character at a given index in the TextBlock
- TextBoxValidationExtensions - extensions that allow to specify the Format of the requested Text input as well as brushes to use to highlight a TextBox with valid or invalid Text.
- ViewboxExtensions.GetChildScaleX()/GetChildScaleY() - return the effective scale of the Viewbox Child.
- VisualTreeHelperExtensions - provides a set of extension methods that enumerate visual tree ascendants/descendants of a given control - making it easy to do these operations with LINQ as well as simple ways to list controls of a given type or find the first control of a given type searching up or down the visual tree
- WebViewExtensions - extensions to get currently loaded page address, title, favicon, head tag's inner HTML.
- BindingDebugConverter - helps debug bindings by allowing to trace or break whenever a binding gets updated.
- BooleanToDataTemplateConverter - given two DataTemplates (TrueTemplate and FalseTemplate) - converts the input value to the given template. A different take on DataTemplateSelector.
- BooleanToVisibilityConverter - the mother of all converters
- ColorToBrushConverter - converts a Color to a Brush
- SecondsToTimeSpanStringConverter - converts the number of seconds (a double type) to a TimeSpan - useful for configuring some animations
- VisualTreeDebugger - provides a trace of the visual tree structure when a control loads, its layout updates or it gets tapped as well as allowing the application to break in the debugger if one of these events occurs
- Debug/DebugConsole/DebugConsoleOverlay/DC.Trace() - enables tracing and displaying traced information right in the application on a collapsible panel
- Imaging Extensions
- BitmapImageLoadExtensions - extensions to simplify loading BitmapImages based on StorageFile or file name
- ColorExtensions - Conversions between pixels and pixel buffer types of byte, int and Color
- IBufferExtensions - Adds a GetPixels() extension method to the PixelBuffer property of a WriteableBitmap that reads in the buffer to a byte array and exposes an indexer compatible to the one of the Pixels property in Silverlight's WriteableBitmap
- WriteableBitmap~- a set of extension methods for a WriteableBitmap
- WriteableBitmapSaveExtensions - support for loading and saving the bitmap to/from files
- WriteableBitmapBlitBlockExtensions - support for quick blitting of a full-width section of a bitmap to another bitmap of same width
- WriteableBitmapCopyExtensions - support creating a copy of a WriteableBitmap
- WriteableBitmapCropExtensions - support for creating a cropped version of a WriteableBitmap
- WriteableBitmapDarkenExtension - performs image processing to darken the pixels of the WriteableBitmap.
- WriteableBitmapFloodFillExtensions - support for flood-filling a region of a WriteableBitmap - either limited by an outline color or by replacing a given color - usually a color at the starting position or colors similar to it
- WriteableBitmapFromBitmapImageExtension - allows to create a WriteableBitmap from a BitmapImage assuming the BitmapImage is installed with the application.
- WriteableBitmapGrayscaleExtension - performs image processing to make the pixels of the WriteableBitmap (more) grayscale.
- WriteableBitmapLightenExtension - performs image processing to lighten the pixels of the WriteableBitmap.
- ScaledImageFile.Get() - Used to retrieve a StorageFile that uses qualifiers in the naming convention.
- StorageFileExtensions.GetSize()/.GetSizeString() - allow to get the size of a file and its string representation (automatically converting from bytes to kB, MB, GB, TB)
- .ContainsFile() - returns a value that states whether a file with specific name exists in the folder
- .CreateTempFile() - creates a temporary file
- .CreateTempFileName() - returns an unused, unique file name for a temporary file
- StringIOExtensions - allows to easily read or write a string from/to file in a single call
- JsonSerialization - allows to serialize a properly DataContract-annotated object to a JSON string or file or deserialize an existing one.
- XmlSerialization - allows to serialize a properly DataContract- or XmlSerializer-annotated object to a XML string or file or deserialize an existing one.
- Net.WebFile.SaveAsync()- downloads a file from a given URL, automatically figuring out the recommended file name and saving it to a given or default folder
- BackgroundTimer - a timer class similar to DispatcherTimer in its interface, but somewhat more precise and running on a background thread
- EnumExtensions.GetValues<T>() - allows to get an array of strongly typed values of enum type T
- TryCatchRetry - allows to run a specific Task or Action, catching exceptions and retrying for a specified number of retries, with optional delays in between (mostly a debugging tool or a means of temporary workarounds)
WinRT XAML Toolkit - 1.2.0 (Click here for the latest version)
WinRT XAML Toolkit based on the Windows 8 RTM SDK.
Download the latest source from the SOURCE CODE page.
For compiled version use NuGet.
You can add it to your project in Visual Studio by going to View/Other Windows/Package Manager Console and entering:
PM> Install-Package winrtxamltoolkit
- AsyncUI extensions
- Controls and control extensions
- Debugging helpers
- IO helpers
- VisualTree helpers
Here's a snap of the Solution;
The latest drop compiled and ran for me the first time with no problems. Here's some snaps of the sample app;