Monday, February 21, 2011

Can you use sketchflow controls/styles in a WPF application?

I really love the sketchy-ness of the Sketchflow buttons and controls, and would love to use those controls/styles in my own WPF app, can this be done in anyway? Perhaps just reference the Sketchflow binaries?

From stackoverflow
  • Hey, the Sketchflow Application uses the "SketchStyle.xaml" for all of the Sketch-Styles. You can find this xaml-file when you create a new Sketchflow-Application with Blend.

    And from this xaml-file you can copy the styles. You just have to copy all the style into the app.xaml of your Application or your ResourceDictionary. And than you can just use them, for example for your buttons, with:

    <Button Content="My Button" Style="{DynamicResource Button-Sketch}"/>
    

    I hope this helped you.

    Mark : thanks a lot for the advice :)
  • I believe this should work if you do the following:

    • Add SketchStyles.xaml to your wpf project (easiest way is to find it by creating a wpf SketchFlow project and copying it from there)
    • Reference Microsoft.Expression.Prototyping.SketchControls.dll in your project (found here on my system: C:\Program Files (x86)\Microsoft SDKs\Expression\Blend.NETFramework\v4.0\Libraries)
    • Add a directory named "Fonts"
    • In that directory, add the 3 fonts found in a SketchFlow project
    • To make the default Sketch font work, open SketchStyles.xaml in xaml editing mode, and find the line with "Buxton Sketch", it will have a reference to your old project, it should be changed to look like this: < FontFamily x:Key="FontFamily-Sketch">Fonts/#Buxton Sketch< /FontFamily>
    • Last, edit app.xaml in xaml editing mode and make sure it looks like this:

    < Application.Resources>

    < !-- Resources scoped at the Application level should be defined here. -->
    < ResourceDictionary>
        < ResourceDictionary.MergedDictionaries>
            < ResourceDictionary Source="/Microsoft.Expression.Prototyping.SketchControls;component/ScrollViewerStyles.xaml"/>
            < ResourceDictionary Source="SketchStyles.xaml"/>
        < /ResourceDictionary.MergedDictionaries>
    < /ResourceDictionary>
    

    < /Application.Resources>

    Mark : thanks so much, every step worked perfectly!

0 comments:

Post a Comment