Skip to main content

Microsoft Silverlight

Answered Question VisualStateGroup name always return null?RSS Feed

(0)

cncolder
cncolder

Member

Member

45 points

29 Posts

VisualStateGroup name always return null?

 Here is my xaml file:

<!-- Xaml -->
<vsm:VisualStateManager.VisualStateGroups>
	<vsm:VisualStateGroup x:Name="VisualStateGroup1">
 		...
	</vsm:VisualStateGroup>
</vsm:VisualStateManager.VisualStateGroups>

When I use the xname in code file like this:

VisualStateGroup1.CurrentStateChanging += new EventHandler...
I find that the visual state group name return null. Not implemented that?




-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
http://www.ViTarn.com/

pbrooks
pbrooks

Contributor

Contributor

2671 points

355 Posts

Silverlight MVP
Answered Question

Re: VisualStateGroup name always return null?

cncolder,

You could do something like this:

var vsGroup = VisualStateManager.GetVisualStateGroups(LayoutRoot)[0] as VisualStateGroup;
vsGroup.CurrentStateChanging += new EventHandler<VisualStateChangedEventArgs>(vsGroup_CurrentStateChanging);
...
private void vsGroup_CurrentStateChanging(object sender, VisualStateChangedEventArgs e)
{
    System.Diagnostics.Debug.WriteLine(e.NewState.Name);
}

If this has answered your question, please click on "Mark as Answer" on this post.

Thanks,
Page Brooks
Silverlight MVP, MCSD
PageBrooks.com | @pbrooks

cncolder
cncolder

Member

Member

45 points

29 Posts

Re: VisualStateGroup name always return null?

Yes. I have done like your code. I wanna find why it's null only. But still would like to thanks




-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
http://www.ViTarn.com/
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities