Hi, Thank you guys for your helpful comments.
@Bob: It was really a png, my textual comments were wrong @Nick: The UIColorFromPatternImage works fine. My app uses the AdvancedColorPicker of Yiannis Bourkelis (thank you Yiannis) were the user can e.g pick a background color for all dialog elements. I want to use this color with a gradient. That's easy for the custom elements which I draw manually anyhow. But for all elements derived from StyledStringElement I have to provide it via an image. So the idea is to generate the required background image when the user picks a color, save it and use it for all StyledStringElements until the user picks a different color. This now works fine thaks to your support :) Guido. On 22 January 2013 14:54, Nic Wise <[email protected]> wrote: > I stand corrected. I CLEARLY need to update my MT.D library! > > Looking at the code: > > https://github.com/migueldeicaza/MonoTouch.Dialog/blob/master/MonoTouch.Dialog/Elements.cs#L871 > > BackgroundUri is only used if BackgroundColor isn't set. So make sure > thats null. The Uri uses the image loader, so it might require a HTTP > url, not a file one. You could use BackgroundColor with > UIColor.FromPattern and pass in your local image (load it with > UIImage.FromFile or FromBundle) > > ....which is what the Uri one is doing anyway - it's just doing it > using the backgroud thread. > > On 22 January 2013 13:48, Nic Wise <[email protected]> wrote: >> I've never seen a BackgroundUri property. I've seen Background, which >> is normally a UIView (and you can load a UIImage into it with new >> UIImageView(UIImage.FromFile("your filename.png")) )....? >> >> that said, I dont use styledstringelement much, so I might have missed it :) >> >> On 22 January 2013 13:28, Robert Reck <[email protected]> wrote: >>> Probably just a typo, but in your code you reference a .png file. In your >>> text you reference a .jpg file. Are you sure you have the right extension >>> on the file name? >>> >>> Bob >>> >>> -- >>> Bob Reck <[email protected]<mailto:[email protected]>> >>> PII Quality Assurance Auditor >>> Senior Applications Developer >>> ___________________ >>> www.keylogic.com<http://www.keylogic.com/> >>> 443.539.9065 >>> 301.621.8920 (fax) >>> >>> The information contained in this message may be privileged, private and >>> protected from disclosure. If the reader of this message is not the >>> intended recipient, or an employee or agent responsible for delivering this >>> message to the intended recipient, you are hereby notified that any >>> dissemination, distribution or copying of this communication is strictly >>> prohibited. If you have received this message in error, please notify us >>> immediately by replying to the message. >>> >>> On Jan 22, 2013, at 7:18 AM, "Guido Van Hoecke" >>> <[email protected]<mailto:[email protected]>> wrote: >>> >>> Hi, >>> >>> I want to use a background image for a StylesStringElement, and somehow >>> that does not work. Here's the straightforward code: >>> >>> Root = new RootElement("I'm the root") { >>> new Section { >>> new StyledStringElement { >>> Caption = "I'm styled", >>> TextColor = UIColor.Black, >>> BackgroundColor = UIColor.Clear, >>> BackgroundUri = new Uri(@"file://Images/MyBackground.png"); >>> } >>> } >>> } >>> >>> I'd expect to see an element with the MyBackground.jpg, but I get a plain >>> white background. The setting of the clear background also has no effect >>> at all. >>> >>> I think that the BackgroundUri is the only straightforward method to set >>> a background to replace the plain color background. >>> >>> But apparently, there's something missing in the state of... >>> >>> Any suggestions? >>> >>> >>> Guido >>> >>> -- >>> Where am I? Who am I? Am I? I >>> >>> http://vanhoecke.org ... and go2 places! >>> _______________________________________________ >>> MonoTouch mailing list >>> [email protected]<mailto:[email protected]> >>> http://lists.ximian.com/mailman/listinfo/monotouch >>> _______________________________________________ >>> MonoTouch mailing list >>> [email protected] >>> http://lists.ximian.com/mailman/listinfo/monotouch >> >> >> >> -- >> Nic Wise >> t. +44 7788 592 806 | @fastchicken >> b. http://www.fastchicken.co.nz/ > > > > -- > Nic Wise > t. +44 7788 592 806 | @fastchicken > b. http://www.fastchicken.co.nz/ _______________________________________________ MonoTouch mailing list [email protected] http://lists.ximian.com/mailman/listinfo/monotouch
