Lester's WPF\SL Blog


Simple, Easy & Beautiful


 

November, 2009

Blog - Post Feedback Form(CAPTCHA)
  • Lester's WPF\Silverlight Blog

    Concluding "New WPF Features" Series

    • 4 Comments
    This is the last part of a series on New WPF Features The list of features covered here as part of this series: · MultiTouch · DatePicker\Calendar · Datagrid · Visual State Manager (VSM) · Easing Functions · JumpLists · Pixel Shader 3 support · Cached Composition · Full trust Xbap Deployment · Binding to Dynamic Objects · Custom Speller Support · Script Interop in Xbap · UIA Virtualization · UIA SynchronizedInputPattern · Input Key\Gesture Binding · TextFormattingMode · CaretBrush · SelectionBrush · Bindable Run · ClearTypeHint · LayoutRounding · Updated File Dialogs XAML 2009 · Built-in Types · Node Loop Flexibility · Event Handling · Named Object References...
  • Lester's WPF\Silverlight Blog

    New WPF Features: MultiTouch

    • 0 Comments
    This is part of a series on New WPF Features WPF supports multitouch API’s in .NET 4. You can have touch and manipulation operations on all the UI elements. For creating a touch based app, you would need to subscribe to the events: · TouchDown · TouchEnter · TouchLeave · TouchMove · TouchUp The TouchEventArgs class has some helpful API · GetTouchPoint - Returns the current position of the touch device relative to the specified element. · TouchDevice - Gets the device that generated the event. · Device - Gets the input device that initiated this event. (Inherited from InputEventArgs .) To add manipulations, you first need to set the bool IsManipulationEnabled property. Once done you can now listen to the...
  • Lester's WPF\Silverlight Blog

    TestAPI 0.4 Released

    • 0 Comments
    TestAPI has come out with a new release V0.4. Please do check it out. So what’s new: Deep Object Comparison utility Text String Generation for random interesting combination of strings A Leak Detection API that enables the user to determine if the application is leaking Enhanced Combinatorial Variation Generation – supports tagged and weighted values
  • Lester's WPF\Silverlight Blog

    New WPF Features: DatePicker\Calendar\VSM\Datagrid

    • 1 Comments
    This is part of a series on New WPF Features These controls have been part of the WPF toolkit on Codeplex. They are now making their way into the framework. You can get the usage details from the codeplex site WPF Toolkit: DataGrid Feature Walkthrough WPF Toolkit: Visual State Manager Overview WPF Toolkit: DatePicker and Calendar Walkthrough < Calendar FirstDayOfWeek ="Monday" /> < DatePicker FirstDayOfWeek ="Monday" /> < DataGrid ItemsSource ="{StaticResource myData}" /> Have fun Share this post
  • Lester's WPF\Silverlight Blog

    XAML 2009 Features: FactoryMethod\Arguments

    • 0 Comments
    This is part of a series on New WPF\XAML Features Another new feature in XAML 2009 is the possibility of creating objects using the non-default constructors. The keyword here is x:Arguments So creating a person object with a constructor requiring Name\Age could be written in XAML as < local : Person > < x : Arguments > < x : String > Tom </ x : String > < x : Int32 > 21 </ x : Int32 > </ x : Arguments > </ local : Person > Next interesting feature is using FactoryMethods… the keyword here is x:FactoryMethod <p:Guid x:FactoryMethod ='NewGuid'/> You could also combine x:Arguments with FactoryMethod < coll : List x : Key ='list' x : TypeArguments...
  • Lester's WPF\Silverlight Blog

    XAML 2009 Features: Generics Support

    • 0 Comments
    This is part of a series on New WPF\XAML Features XAML 2009 supports generics J .. In previous releases, if you needed to have an observableCollection for databinding you would probably have written code like class PersonCollection :ObservableCollection < Person > {} < l : PersonCollection > < Person Name ="Tom" /> </ l : PersonCollection > In this release, you can now write this as < ObservableCollection x : TypeArguments ='local:Person' xmlns ='clr-namespace:System.Collections.ObjectModel;assembly=System' > < local : Person Name ='Tom' Age ='21' /> </ ObservableCollection > … < ListBox ItemsSource ='{ Binding }' DisplayMemberPath ='Name'></ ListBox >...
  • Lester's WPF\Silverlight Blog

    New WPF Features: SynchronizedInputPattern

    • 0 Comments
    This is part of a series on New WPF Features In previous releases, sending input through automation was tricky mainly because the app and the automation processes were separate. The app state could change between the time the input was sent and received. As an example, suppose you need to click something but before the click happens, the elements move (maybe due to resize …). In this case, some other element could get the mouse input. To overcome this problem, we have introduced the SynchronizedInputPattern . Now the framework sees where the input is going and if its not the intended target, the input is cancelled. The sender is notified whether the input operation was successful or not and based on it can make a decision to try again...
  • Lester's WPF\Silverlight Blog

    New WPF Features: PixelShader3 Support

    • 0 Comments
    This is part of a series on New WPF Features Previously WPF only supported Pixel Shader 2.0 (PS 2.0). For this release, we added PS 3.0 support providing the benefits of more instructions, registers .... The usage is similar as before. However, we have provided an API to determine if the shader can be run on the machine. The API’s are self-explanatory · RenderCapability . IsPixelShaderVersionSupported (majorversion,minorVersion) · RenderCapability . IsPixelShaderVersionSupported InSoftware (majorversion,minorVersion) · RenderCapability . MaxPixelShaderInstructionSlots (majorversion,minorVersion) (snapshot of app on a PS2.0 supported machine) Sample project attached . Share this post
  • Lester's WPF\Silverlight Blog

    New WPF Features: UIA Virtualization

    • 2 Comments
    Pre .NET 4, from a UI automation perspective, virtualization was not a good story. There wasn’t a standard way of dealing with virtualized controls, since some would expose only the visual elements while the others would create an automation tree that had every element. To fix this problem, in .NET 4, we have introduced 2 new UIA patterns: ItemContainerPattern\VirtualizedItemPattern ItemContainerPattern enables searching the whole tree irrespective of it being virtualized. testObject.GetCurrentPattern( ItemContainerPattern .Pattern) Search is done using the FindItemByProperty function which has 3 parameters - AutomationElement startAfter: element to start search from. Setting to null would mean start from beginning - AutomationProperty...
  • Lester's WPF\Silverlight Blog

    XAML 2009 Features: Named Object References

    • 0 Comments
    This is part of a series on New WPF\XAML Features In previous releases, if you needed to reference a named object, your XAML would look something like < Label Target =' { Binding ElementName =firstNameBox }' > _Target </ Label > < TextBox Name = 'firstNameBox' > Uses Binding </ TextBox > In the current release (.NET 4), we introduced a built in markup extension x:Reference . This would enable referencing a named object. The above XAML can now be written as < Label Target = ' { x : Reference secondNameBox }'> _Second Target </ Label > Or < Label Target = 'thirdNameBox' > _Third Target </ Label > The references look both forward as well as backwards Another possibility...
  • Lester's WPF\Silverlight Blog

    New WPF Features: Updated File Dialogs

    • 2 Comments
    This is part of a series on New WPF Features In previous releases, WPF open\Save dilogs had the XP style even on Vista. Some workarounds were to use the Vista bridge library or use the winforms dialogs. For this release we fixed this issue. You now get the OS style dialogs :) ... Usage wise its the same, you get the updated behavior for free ... The pic below shows the difference. Share this post
  • Lester's WPF\Silverlight Blog

    XAML 2009 Features: XAML Event handling

    • 0 Comments
    [ This is part of a series on New WPF\XAML Features] In previous releases, when loose XAML had events in it and was loaded it would crash. In V4, there are 2 options to avoid this crash. à On loading events are searched on the root object of the XAML file. Suppose you had the loose XAML like the below < local : MyStackPanel xmlns ="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns : local ="clr-namespace:DemoApp;assembly=DemoApp"> < Button Click ="Button_Click" > Date (Event on Root) </ Button > As long as the root object (in this case MyStackPanel) can be found, the event will be hooked and will work fine without a crash à The second approach is to define a MarkupExtension that returns...
  • Lester's WPF\Silverlight Blog

    New WPF Features: Cached Composition

    • 7 Comments
    This is part of a series on New WPF Features One of the big improvements in 4.0 is the Cached Composition feature in graphics. This feature enables caching a live UIElement as a bitmap, which enables quick rendering of the element as a bitmap. The UIElement is user interactive and hence will respond to keyboard input, mouse clicks,… Also, transforms, effects,.. which operate on top will not cause the cache to regenerated resulting in better performance. Previously, it was common to use RenderTargetBitmap for this purpose. However, this would be at the cost of interactivity. Lets jump into usage. You have the BitmapCache and the BitmapCacheBrush classes. The former is useful in rendering a complex UIElement while the latter facilitates...
  • Lester's WPF\Silverlight Blog

    XAML 2009 Features: Node Loop flexibility

    • 2 Comments
    [ This is part of a series on New WPF\XAML Features] So by now most of you must have noticed the System.Xaml dll as part of your .NET 4 WPF projects. It’s a well componentized XAML stack that provides a lot of flexibility working with XAML. So at the core we a System.Xaml.XamlReader and XamlWriter which provide the base implementation and definition for a reader and writer. XamlXmlReader is a reader that reads in XAML and produces a XAML node stream. This stream is then consumed by a XamlXmlWriter XamlObjectWriter to produce the object graph. Similarly for the Save path, you have the XamlObjectReader and XamlXmlWriter. So the Load Path looks like XAML à XXR à Node Stream à XOW à Object Graph The Save path would look like...
  • Lester's WPF\Silverlight Blog

    New WPF Features: Full Trust Xbap Deployment

    • 4 Comments
    This is part of a series on New WPF Features In earlier versions, on trying to deploy a Full Trust Xbap, you would get a "Trust Not Granted" error. Its possible to workaround this issue by installing an assembly in the GAC that has the AllowPartiallyTrustedCallersAttribute. Another option is to install a certificate on the user machine and sign the Xbap with the certificate. Yeah, its painful and we worked on this issue for this release Now on deployment, you would get a clickonce dialog so that the user can determine if s\he want to run the Xbap. This is really beneficial in the case of Intranet deployment. Do I hear a WOW.. :) Below is the pictorial difference.. In addition, clicking on the More Information link open up a dialog...
  • Lester's WPF\Silverlight Blog

    Xaml 2009 Features: Built in Types

    • 8 Comments
    In Xaml2009, we have built-in support for common CLR types which simplifies authoring. So rather than specifying something like < s:String xmlns:s ="clr-namespace:System;assembly=mscorlib"> Foo </ s:String > We can use the notation < x:String > Foo </ s:String > The list of types supported is below: • < x:String > • < x:Char > • < x:Single > • < x:Double > • < x:Boolean > • < x:Byte > • < x:Int16 > • < x:Int32 > • < x:Int64 > • < x:Decimal > • < x:Object > • < x:Uri > • < x:TimeSpan > • < x:Array > One thing to note is wrt WPF this will work only in loose Xaml . This means that these...
  • Lester's WPF\Silverlight Blog

    New WPF Features: Bindable Run

    • 0 Comments
    This is part of a series on New WPF Features Bindable run - yeah its possible currently but you would require a custom implementation. if you didnt like to create your own implementation, likely you would be using textblock. Problem here is that its likely you would have issues in copy paste scenarios, layout and what not. Now its a lot easier as the framework supports it. < WrapPanel xmlns ="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x ="http://schemas.microsoft.com/winfx/2006/xaml" > < TextBlock Text ='Hello world!! .NET 4 Coming Soon!! New features in WPF!!' Visibility ='Collapsed' Name ='tbl'></ TextBlock > < FlowDocumentReader Width ="350" BorderBrush ="red" BorderThickness ="3"...
  • Lester's WPF\Silverlight Blog

    New WPF Features: Script Interop in Xbap

    • 1 Comments
    This is part of a series on New WPF Features Often times you have Xbap hosted in a Html page and its pretty common to have some kind of interaction between the host and Xbap. In this release, we have enabled these scenarios. Operation Changes In Code Sample Invoking a function Xbap dynamic script = BrowserInteropHelper .HostScript; script.ReportProgress (progressValue.ToString()); Passing an object to a function Script function ReportDate(dateTime) { date = new Date(dateTime); var dateBox = document.getElementById( "displayDate" ); dateBox.value = date.getFullYear(); } Xbap DateTime date1 = ( DateTime )date.SelectedDate; script...
  • Lester's WPF\Silverlight Blog

    New WPF Features: Binding to Dynamic Objects

    • 0 Comments
    This is part of a series on New WPF Features C# 4.0 allows creation of dynamic objects which is useful when you are interacting with dynamic languages. If you are unfamiliar with the dynamic concept take a quick look at this blog entry So back to WPF. We support binding to dynamic objects.. woohoo... To begin with you need to create the dynamic object (see attached proj ) < Window.Resources > < local : DynamicObjectClass x : Key ="MyDynamicObject" /> </ Window.Resources > < StackPanel Name ="BindPanel" DataContext ="{ StaticResource MyDynamicObject }" > < TextBox Text ="{ Binding Path =A}"/> < TextBlock Text ="{ Binding Path =B.C}" /> < TextBox Text ="{ Binding Path =[(x:Int32...
Page 1 of 1 (19 items)