Sunday, July 12, 2009

Silverlight :Expander within AccordianItem with a theme Applied: sys.InvalidOperationException : AG_E_UNKOWN_ERROR

my team was working in a XAML where we need to add themes to a accordian items when there was Expander controls within the accordian..

whenever we applied themes to this partucular xaml we came across an err like :

sys.InvalidOperationException : AG_E_UNKOWN_ERR

Initially i thoughought this was a Silverlight 2.0 errr....but then started to see why this err occurs and jumped in to my task getting to the core of the xaml, removing controls one by one untill the issue was kicked off...

1. removed most of the controls in the xaml, and holded only the err prone controls.
2. removed the themes first - it worked.
3. added themes - err reproduced.

then thought of havinng the round abouts of making the controls invisible in the XAML And then make them visible during the run time in the C# code.

I drilled down and saw that Expanders inside the accordian got the errs when themes were applied.

i made the expander Visibility="Collapsed" and then in code behind made the visibility of the expanders

Now the err was not appearing ....this is one way of approach to remove errrs when we apply themes for expanders inside the accoridians in Silverlight

,,,
Senthil

1 comment:

Dotnet Etisbew said...

Perfect Post about the way to handle accordian items in Silverlight. See my blogpost about ASP Dot Net Developers