Sunday, December 27, 2009

New features in Silverlight 4 Beta: Implicit Styles & CompositeTransform

In this post I’ll show two useful features: implicit styles and new transform - CompositeTransform.

Implicit Styles

implicit_styles_vB

Useful links

CompositeTransform

composite_transform_vB

Useful links

New features in Silverlight 4 Beta: Out Of Browser Applications (Trusted)

I previously wrote a post about new features of sandboxed out of browser applications. This post focuses on trusted applications.

Trusted application features

  • Install requires users to “trust” the application
  • Group Policy support for
    • Disabling installation of Trusted Applications
    • Disabling activation of Trusted Applications

trusted_01

  • Native Integration / COM Automation objects on Windows
    • ComAutomationFactory
    • C# 4.0 “dynamic” programming model
    • Standard language feature in Visual Basic
    • Automation features supported in SL 4 Beta
      • Property get/set, indexed property get/set
      • Positional and optional parameters
      • Support by ref and by value
      • In proc and out of proc servers
      • Support VARIANT, BSTR, SAFEARRAY
      • Sink dispatch events with arguments
    • Automation features not supported in SL 4 Beta
      • Marshalling user defined types
      • Multi-dimensional or jagged arrays
      • Named parameters
      • IEnumVariant
      • Type Information

trusted_02

  • File System Access
    • Folders: MyDocuments, MyMusic, MyPictures, MyVideos
    • These folders are distinct from the Windows 7 Libraries

trusted_03

  • Relax sandbox speed bumps
    • Enable cross domain HTTP networking
    • Eliminate site locking for WebBrowser
    • Full path in Open/SaveFileDialog
    • Eliminate user initiation
      • Open/SaveFileDialog
      • Clipboard access
      • Full screen mode
      • Changing window settings
    • Enable full keyboard in full screen mode

trusted_04

Useful links

Monday, December 21, 2009

New features in Silverlight 4 Beta: Out Of Browser Applications (Sandboxed)

Out of browser applications are cool, aren’t they? In the near future I’ll write two posts about it. Today I’ll present enhancements of sandboxed applications.

Sandboxed out of browser additions:

  • Web Browser/HTML hosting
    • WebBrowser control
    • HtmlBrush
  • Window settings
    • Runtime changes to Height/Width
    • Specify startup location (in manifest)
    • Runtime control over WindowState (Normal, Minimized, Maximized)
    • Supports “TopMost” Apps (toolbar apps)
    • Enable App “Activate” (Normal window state - bringing to front, Minimized - flashing the taskbar)
  • Toast notifications (NotificationWindow)
  • DRM media playback
  • Add/Remove Program Integration

WebBrowser control is cool, but it doesn’t support opacity, rotation, effects and overlaid content (Silverlight content on HTML).

HtmlBrush requires manual refreshing (Refresh method).

NotificationWindow also has some limitations:

  • Size up to 400 x 100
  • Popup duration to 30 seconds
  • Cannot set opacity and rounded corners
  • Cannot launch popup windows
  • Location is fixing per operating system (Windows - lower right, OS X - upper right)

out-of-browser_0 out-of-browser_1out-of-browser_2

You can make much more. Look at cool HTML Puzzle example from PDC ! 

puzzles

Useful links

Friday, December 18, 2009

New features in Silverlight 4 Beta: RichTextArea Control, Right to Left Flow Direction & Text Trimming

Have you checked out the new cool RichTextArea control or TextBlock with trimming ? Read this post.

The RichTextArea allows hyperlinks, XAML content, and embedding of images. It supports changing the font size, foreground color, and making text bold, italicized, and underlined.  Paragraph blocks allow different formatting of blocks of text. Mouse events, clipboard, undo, language localization are also supported.

richtextarea_1

Some limitations

  • UI elements and hyperlinks are active only in read-only mode.
  • You can cut, copy, or paste only plain text.
  • Undo is supported only if the IsReadOnly property is false.

richtextarea_3

You can now set the direction of content and layout of each control to flow from right side to the left (which is useful for some languages such as Hebrew or Arabic). All UIElement controls inherit the FlowDirection from their parent except Image, MediaElement, MultiScaleImage and Popup. When brushes and effects are applied to elements whose FlowDirection property is set RightToLeft, the result is flipped horizontally.

richtextarea_4

The TextBlock has a new TextTrimming property. When this property is set to WordEllipsis and the text in the TextBlock exceeds the visible limit, the text appears truncated with a trailing three ellipsis.

texttrimming_12

Other text improvements

  • Arabic and Hebrew Text Support
  • IME (Input Method Editors) improvements for TextBox
  • UIElement: TextInputStart, TextInputUpdate, TextInput events

Useful links: 

Wednesday, December 16, 2009

New features in Silverlight 4 Beta: Navigation Page Loading Extensibility & Data Binding Changes

Today I’ll show two new Silverlight 4 features: custom navigation and data binding enhancements.

Navigation Page Loading Extensibility

Now you can extend the navigation system by setting a new ContentLoader property of the Frame class to a custom INavigationContentLoader implementation. The default ContentLoader property value is an instance of the PageResourceContentLoader class.

navigation_1 

Useful links

 

Data binding changes

I have made two sample applications to demonstrate new data binding features.

Data Binding Sample One

  • Validation with IDataErrorInfo interface (ValidatesOnDataErrors)
  • String formatting, Null and Fallback values (StringFormat, TargetNull, FallbackValue)
  • Databinding support for dependency objects
  • Grouping on CollectionViewSource

binding_validation_1

Data Binding Sample Two

  • Synchronous and asynchronous validation with INotifyDataErrorInfo interface (ValidatesOnNotifyDataErrors)
  • Command property on ButtonBase and Hyperlink (in the sample: Button)
  • Binding to string indexers
  • SelectedValue and SelectedValuePath on the Selector (in the sample: ComboBox)

binding_validation_2abinding_validation_2b

Other data binding  improvements

  • ObservableCollection<T> constructor that takes IEnumerable or IList
  • IEditableCollectionView (for example PagedCollectionView)

Useful links

Friday, December 11, 2009

New features in Silverlight 4 Beta: Fluid UI States for ItemsControl

Now you can animate items into/out of ItemsControls ! Read this post.

The ListBoxItem has a new visual state group called Layout States that has BeforeLoaded, Loaded, and Unloaded visual states. These visual states help animate the transition between states when an item is loaded and unloaded from an ItemsControl. Fluid states are applied to containers generated from a DataTemplate.

ListBoxLayoutStates_0ListBoxLayoutStates_2ListBoxLayoutStates_3

Useful links

Thursday, December 10, 2009

New features in Silverlight 4 Beta: MouseWheel Support, Clipboard Access & DataGrid Enhancements

Today I’ll write some information about clipboard, new features of DataGrid and mouse scrolling.

Silverlight 4 adds the ability to programmatically access the clipboard to format and modify data during copy, cut, and paste operations (text only). When an attempt is made to programmatically access the clipboard for the first time, Silverlight will prompt the user to request permission.

clipboard_2clipboard_3

You can copy a row of a DataGrid to the clipboard (CTRL + C) and then paste it to another program (f.e Excel). You can control what is copied for a particular column by using the DataColumn.ClipboardContentBinding property to point to different data if the cell contents aren’t what you want to have copied.

The DataGrid in Silverlight now has the ability to allow columns to share the remaining width of a DataGrid (*).  It also supports MouseWheel scrolling and the FlowDirection property.

clipboard_4

Useful links

Wednesday, December 9, 2009

New features in Silverlight 4 Beta: Dragging Files and Right Click

Silverlight version 4 Beta introduces APIs to support dragging a file list to a Silverlight application. You can also handle right-click mouse events and change the behavior (for example show context menu). In this post I’ll show demo with these new features.

silverlight_drag_1silverlight_drag_2

There’ re some limitations with current drag and drop implementation. Only file drag and drop is supported. For drag and drop to work on Windows, Silverlight plugin must be windowed (<param name="windowless" value="false"/>). In order to use drag-and-drop events for applications hosted by Safari on Macintosh, you must forward the relevant DOM events from your own HTML-level scripting to the specific API of the control.

Useful links