Skip to main content

Microsoft Silverlight

Answered Question Application crashes but I don't know what's the problem.RSS Feed

(1)

GearWorld
GearWorld

Participant

Participant

846 points

1,105 Posts

Application crashes but I don't know what's the problem.

The application is crashing when going out of this event

void lstImageSelector_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
    foreach (ImageItem ii in lstImageSelector.Items)
        ii.btView.Visibility =
Visibility.Collapsed;

    ((
ImageItem)lstImageSelector.SelectedItem).btView.Visibility = Visibility;
    ((
ImageItem)lstImageSelector.SelectedItem).btView.Click += new RoutedEventHandler(btView_Click);
}

However it goes there each time I select another item in the listbox without any error but as soon as I click on btView button of the item in the list,  I show an image and get back and then, ONLY THEN, if I select another item in the listbox.  I get into the Application_UnhandledException which doesn't give me a lot of information on what is causing this problem.

Any idea ?

Try it by yourself : http://gearworld.homedns.org:8082/devpreview between 6:00am and 8:30pm EST

xantic
xantic

Member

Member

94 points

12 Posts

Re: Application crashes but I don't know what's the problem.

I have had the same problem. Don't know why but Buttons has some problems when accessing the Visibility property. A workaround is to add a wrapper Grid around the button and set the Visibility property for the Grid. Not the prettiest but should work.

(If this has answered your question, please click on "mark as answer" on this post. Thank you!)

Cheers,
Christian Fredh

GearWorld
GearWorld

Participant

Participant

846 points

1,105 Posts

Re: Application crashes but I don't know what's the problem.

Hi xantic.

 Well I certainly can do a workaround since I know I'm able to.  But I would like somone to know that there's a problem there.  Also I saw that its about the MOUSE CLICK since if I click de View button and get back, then use the KEYBOARD to select another item then it works.

Its just when I click the VIEW button, then click on the IMAGE to go back in the list then select another item with the MOUSE that it crashes.  Of course this doesn't make sence but well,  I think its good to pin point problems for this beta so we can have a very solid piece of product at the end :)

I just hope its not because I do something I shouldn't normaly do !

 

GearWorld
GearWorld

Participant

Participant

846 points

1,105 Posts

Re: Application crashes but I don't know what's the problem.

I think this message should be moved to "Report a SilverLight bug".....

 

Yi-Lun Luo - MSFT
Yi-Lun L...

All-Star

All-Star

25052 points

2,747 Posts

Answered Question

Re: Application crashes but I don't know what's the problem.

Hello, this is a known issue. In MouseLeftButtonUp event handler of Button, it'll first fire Click event (thus call your own handler), and then release mouse capture. But since you've hidden you Button, the ReleaseMouseCaptureInternal method will throw an Exception. So you have to use a workaround.

shanaolanxing - I'll transfer to the Windows Azure team, and will have limited time to participate in the Silverlight forum. Apologize if I don't answer your questions in time.

GearWorld
GearWorld

Participant

Participant

846 points

1,105 Posts

Re: Application crashes but I don't know what's the problem.

Thank you sir

 

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities