开发者

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

开发者 https://www.devze.com 2023-01-05 00:04 出处:网络
I really love the s开发者_C百科ketchy-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

I really love the s开发者_C百科ketchy-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?


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>
    


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号