|
I wrote a simple application in WPf and I`m getting StackOverflowException in PresentationCore.dll. It seems to be WPF bug. It`s impossible to debug or trace the cause, since exception occurs not in my code. I`m attaching the sample application which produces this exception (http://62.233.162.212/martinez/SMOG/Sample%20application.rar[^])
How to produce this exception in this application:
1. The application initially contains 2 polygons. Enlarge the "brown" one a bit
2. Turn off snaping (upper-left corner checkbox)
3. Insert the second polygon inside the former one
4. Move the bigger polygon one or two times - it always throws this exception.
Thank you very much for any help
|
|
|
|
|
The problem isn't with WPF. It's your code that's at fault - basically you have entered an infinite loop in MovePolygon where you execute this section:
foreach (var item in children)
{
item.MovePolygon(xDestination, yDestination);
} You seem to be iterating through the same item every time, and I'm guessing this isn't the effect that you want.
|
|
|
|
|
Hey all,
I'm just trying to make some nice WPF file dialogs for saving and opening files ... is the best way of getting back the file name and which button was clicked best done by implementing some dependency properties?
I keep getting compile errors like 'incorrect return type' due to the void setting on the button click event handlers and so forth.
I really don't want to use the OS native open / save dialog boxes ... they look so horrid!!
Cheers,
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Jammer wrote: I really don't want to use the OS native open / save dialog boxes ... they look so horrid!!
You may need to rethink this because users are already used to those dialogs and it's what you "should" use for this reason. Not sure why you are having issues, they work great for us.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Oh for sure ... the standard ones work ... i'm just getting right into the design side of things and really wanting to maintain that sort of feel over the app ...
have got my dialog working now too ... no need for dependency properties ... I was barking (mad) up the wrong tree with that one.
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
If you are using the standard dialogs, the user has certain control over them through the use of themes, so if you implement your own versions, they need to be consistent with user expectations.
|
|
|
|
|
Hi Pete,
Not sure what you mean here. Do you mean the look and feel expectations or functionality or both together?
Cheers,
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
It's a bit of both. The themes issue relates to what they expect to see - the expectations relates to the interaction they expect from the dialogs.
|
|
|
|
|
Sure that makes complete sense. At the moment I have a nice little dialog that just does what I need it too at the moment ... nothing fancy but its got all the same theme as my app.
It needs expanding on before the final release for sure. I'm also not even allowing browsing to random folders at the moment its just locked into offering file names at the moment. That needs attention for the final release.
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
It's fair enough to redo or change an implementation if what you are after is sufficiently different to the behaviour of a standard dialog.
|
|
|
|
|
Well ya got me there ... at the moment its really not doing anything remotely different.
Guess I'll just have to make something up!
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Hello,
is there a way to Bind a image to a window? I have a button in my application which has a image,
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Image Source="c:\IMG_1861.JPG" Width="200" />
</Window>
Resizing the window does not resize the image, instead it streches and crumbles the image. Is there a way to get away from this? Yes we can draw the Image using WPF that seem to be tedious as far as my application is corncerned, i tried using ViewBox is that the only way out?
Sample application apreciated.
With Rgds,
Anil
|
|
|
|
|
I'm not quite sure what you mean by crumbles the image, but if you don't specify the width it will take up the available space.
Maybe the Stretch and MaxWidth properties can give you the behavior you want.
|
|
|
|
|
The problem that you have is that this is a bitmapped image and not a vector image. If you want an image that scales well, it has to be a vector graphic because a vector graphic uses maths to manage the implementation of the image. When you resize your bitmapped image, it only has so much information to work with, so the image degrades once it is manipulated away from its usual dimensions.
I'm afraid a ViewBox won't help you get round the limitations of your jpeg file.
|
|
|
|
|
Yes thats my problem. I need to convert the bitmap image to Vector graphics. This can be done using Adobe Illustrator using XAML plugin.
Thanks Anil
|
|
|
|
|
AnilUnni wrote: This can be done using Adobe Illustrator using XAML plugin
That's interesting. I didn't know that Illustrator could do that.
|
|
|
|
|
Pete,
Illustrator has a plug-in to export vector images and scenes to xaml. It works great.
The converting of bitmpat images to vector article is a done by tracing, I have not seen one yet that does a great job on complex photos.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Karl Shifflett wrote: Illustrator has a plug-in to export vector images and scenes to xaml. It works great.
Nice, although we are using Expression for our artwork (and looking into Zam3D based on Jammer's recommendation).
|
|
|
|
|
There are also utility apps for PSD - XAML converting, I've had limited success using this one here though as it can't handle complex PSD's. There are quite a few things potentially in a PSD that just don't map to any equivilent in XAML or WPF.
I've been working with ZAM3D some more ... I'm even more impressed with it now than when I recommended it!!! I've had a few crashes which is unfortunate but to be expected with a v1 app I guess ...
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Hi All,
Does anyone have any tips on tracking down hard to find problems in XAML?
My application runs without any hitches and everything works as designed.
Blend opens the solution and displays the main window with out any errors or problems building the solution.
But VS2008 wont show the main screen in its XAML designer pane and says that there is an un-handled exception "Object reference not set to an instance of an object." I've seen this error and solved it before but the exception track trace gives no clue as to the source of the exception.
Thanks,
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Jammer,
1. build often so that things don't creep in.
2. I've seen this too. Blend likes this, VS doesn't. Also in the reverse.
3. To find your problem, open in VS and remove sections one at a time until the offending section is discovered. Then, go look at the constructors for code and controls in the offending section. You really need to watch code in your constructors as if it blows up, you get "REAL" misleading exception messages.
Hope this helps.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Yeah, i builld really often ... in fact almost constantly as I'm still really feeling my way around .NET in general.
I have a couple of ideas as to what might be doing it ... I need to investigate these. I think your idea of removing sections (do you mean controls and use controls?) will be a good one ...
Do you know of any plans by the WPF team to tighten the grip on XAML exceptions like this? I was chatting to another Developer at work today (a contractor) and he was expressing similar feelings about how difficult it can be to track down XAML problems.
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Jammer wrote: Do you know of any plans by the WPF team to tighten the grip on XAML exceptions
Have not heard of any specific rumblings, which is why I build often and learn the do's and don'ts. Comes with time, you'll get it all sorted out.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
For sure ... nothing beats experience.
I have my data loading and saving via my custom dialog now ... all looking very WPF and spanky new sparkly nice ...
Just trying to find out where the Serialization exceptions live now ...
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
Unfortunately, the issue with the designer pane reporting an unhandled exception is consistent with the behaviour of the old WinForms designer. The problem actually relates to the designer having to "compile and interpret" the item in the designer, and some things just go wrong. I usually find that attempting a clean rebuild is a good idea in order to find issues.
|
|
|
|