2011-10-20 4 views
5

में सेट करें मेरे पास टैबइटेम शैली है, जिसमें विजुअलस्टेट हैं।xaml में कस्टम विजुअलस्टेट बनाएं और इसे मैन्युअल रूप से CodeBehind

<VisualState x:Name="MouseOver"> 
<!-- Tab turns bronze when mouseover --> 
</VisualState> 

अब मैं एक कस्टम दृश्य राज्य के लिए और मैन्युअल रूप से माउस ले जाएँ घटना पर निर्भर रहने के बजाय codebehind में राज्य की स्थापना की चाहते हैं।

<VisualState x:Name="CustomVisualState"> 
<!-- this will be a storyboard to cause flashing --> 
</VisualState> 

तब मुझे इसे कोडबैंड में सेट करने की आवश्यकता है।

MyTabItem.VisualState = CustomVisualState. //something like this 

उत्तर

1

इस प्रयास करें,

VisualStateManager.GoToElementState(Control, "StateName", true/false); 

या

VisualStateManager.GoToState(Control, "StateName", true/false); 
संबंधित मुद्दे