The Sandbox Post

Single Post Permalink

View Thread: Coding4Fun SudokuFX Article Update - Get Around The Instance Creation Problem Inside Expression Blen
  • User profile image

    This is a small contribution to the excellent Coding4Fun SudokuFX series of articles, which are about WPF.

    Those who are interested in WPF and haven't already read it, please do so now. Wink

    Link to the First Article

    Since I am new to the world of WPF I try to fiddle with any examples I find on the net. So I loaded the sample project at the expression blend beta 2, and saw the error that is displayed in the attached picture. It should be noted that once run, the application displays without a problem, so I guess it is a problem of Blend

    After a little experimentation I found the root of this problem. Blend does not see the application resources when we add the custom control in our window, so a LinearGradientBrush that is used for the background of the usercontrol and is defined in the Application.Resources is the source of the error.

    My workaround was to embed a copy of this resource inside the Usercontrol.Resources and put that as a background. Be carefull though; the usercontrol cannot take this resource and use it as a background, so I set it as a background in the
    <ItemsControl  ...  x:Name ="MainList">
                    <UniformGrid Columns ="1" Background="{StaticResource BoardBackground}"/>

    Attached you will find the updated SudokuFX samples for the articles 2-5.

    This is my first Article so I start with something simple Tongue Out. I hope you find it usefull