Click here to Skip to main content
12,406,124 members (76,016 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# WPF
Hi Guys

Very difficult to write this without using explicit language but i will try.
I have a WPG library, with a WFP user control in it, now all I want to do is set the background of a scrollviewer to an image and tile it

Sounds very simple doesnt it ?

When I try and set it in the designer (as in select my .bmp image saved via MS paint) it never shows up ( it does not neatly add it to a resource file (Like I am so used to with Winforms) no it inputs a url in the markup (XAML <- Always fun listening to Jessie Liberty from microsoft say it)

<ScrollViewer.Background>
               <ImageBrush ImageSource="Images/diagramBG1.bmp" />
           </ScrollViewer.Background>

So when i run it I get the following

'Provide value on 'System.Windows.Baml2006.TypeConverterMarkupExtension' threw an exception.' Line number '12' and line position '18'.

And yes I did copy the image to the local path and directory

So What i would really like to do is! :
be able to assign the image via code and a 64 bit string or a byte array of the image

Feel like a total noob by asking somethign that is conceptually very easy (for just about everything else) but for WPF.

Thanks in Advance
Posted 24-Jan-13 2:41am
L Viljoen5.1K
Updated 24-Jan-13 2:42am
v2

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

My first question is: Have you set the bacground image's compile mode to resource in the project explorer?

If yes, then maybe WPF doesn't like bmp images. I allways use png format. Takes less space and it's lossless.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160726.1 | Last Updated 24 Jan 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100