Page view counter
VisualStateGroup name always return null? Subscribe to this thread
Last post 10-12-2008 8:57 PM by cncolder. 2 replies.
Sort Posts:
10-10-2008 9:27 PM
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/

cncolder

Loading...
Joined on 06-09-2008
Posts 29
10-11-2008 6:17 PM
Marked as Answer
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

pbrooks

Loading...
Joined on 03-23-2006
Florence, SC
Posts 323
10-12-2008 8:57 PM
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/

cncolder

Loading...
Joined on 06-09-2008
Posts 29
Microsoft Communities