Tuesday, March 26, 2013

Another mysterious windows error... they are good at that.

The Error:

System.Windows.Navigation.PageResourceContentLoader.EndLoad (IAsyncResult asyncResult) at
System.Windows.Navigation.NavigationService.ContentLoader_BeginLoad_Callback (IAsyncResult result) at
System.Windows.Navigation.PageResourceContentLoader.BeginLoad_OnUIThread(AsyncCallback userCallback, PageResourceContentLoaderAsyncResult result) at
System.Windows.Navigation.PageResourceContentLoader <>c DisplayClass4.<BeginLoad> b_0(Object args)

What did I find that caused this? Apparently it has to do with defined styles and other resources that are used to call out brushes, templates and any styles. It seems the key phrase is "PageResourceContentLoader" in this error.

one control based off of a defined control ViewModel had a resource still calling for a UserControl

<!-- resource definitions -->

One other time, the reason was that one of the controls on the page had a missing resource definition. The static resource defining a brush had been moved and it could not find it. Once I was able to get that style back, the error was gone (basically, when you get the message or the underline in code saying the resource cannot be found)

Monday, March 25, 2013

The unseeable Telerik gauge

FINALLY figured out how I can see Telerik radial gauges in Blend, after they have been wired up with the view models, bindings, program architect magic. 

I forgot where I read the small snipped of pure gauge genius - but it suggested removing or moving some Telerik dll's out of your local Program folder and then make sure to relink to the solution's shared dll files. 

After a year of frustration - I just looked at the folder and put it on the desktop.

Opened Blend... I SAW MY GAUGES! 

Doesn't take much to make for a happy day, now - I have a scrollviewer that refuses to behave.

Thursday, March 21, 2013

XamlParse Exception for that darn FrameworkElement MeasureOverride

I just wrangled with that fun and oh so detailed error of the XamlParseException that tells you something is wrong with your FrameworkElement MeasureOverride.

After hitting my head on my desk, cursing in my mind (cubicles aren't very private) and wanting to chuck my computer through the window, I figured it out.

This probably won't work for everyone, but it could be a good starting point. In my codebehind I had a SizeChanged declared.

public myControl()
    this.SizeChanged += new SizeChangedEventHandler(myControl_SizeChanger);

Once I commented out (and then got rid of) the size changed event, the error went away.

to get the autosizing I wanted on this control, in the main "header" (that's what I call the code at the top that declares all of the xmlns values), I set a DESIGN height and width instead of simply stating Height and Width :


<UserControl x:Class="application.myClass"
                     mc:Ignorable="d"  d:DesignHeight="100" d:DesignWidth="100">

.... rest of code here

Tuesday, March 5, 2013

More resizing "fun"

Turns out that the project I am currently on has controls with a SizeChanged event already coded into them. 

Our developer noticed this when the app kept refreshing layout over and over and over and over again. So, the solution for these pages was to use MeasureOverride

protected override Size MeasureOverride(Size availableSize)
     this.LayoutRoot.Height = availableSize.Height;
     this.LayoutRoot.Width = availableSize.Width;
     return base.MeasureOverride(availablesSize);

Here is a link with some more information on how this operates. Luckily - I didn't need to have any other code with this one on those pages.