visualstatemanager

What is the proper way to implement VisualStates for multiple VisualStateGroups?

偶尔善良 提交于 2019-12-13 04:51:26
问题 This question is a follow-up to my previous question as well as this related question about how VisualStates work in WPF. Currently, my understanding is that animating the same property within different VisualStateGroups can cause problems (see the linked questions). To resolve these problems, it requires loop-holes to be taken advantage of. (Perhaps loop-hole isn't the correct term, but it appears that the solution isn't what the WPF designers intended.) I'm wondering what is the correct way

DisplayStateBehavior not initially applying state transition in listbox item template

限于喜欢 提交于 2019-12-13 04:43:12
问题 I have a listbox item template that contains visual states. I have DisplayStateBehaviors that set the states to either the on/off states. My implementation only 1/2 works. On initial display, the base state is active, regardless of the value in the DataContext. When the data in the DataContext changes, the proper state is activated. How do I get the proper state displayed on initial display of the listbox. For security reasons I can not copy/paste XAML or View-Model code. Edit : While I can't

Re-use Animations in VisualStates

吃可爱长大的小学妹 提交于 2019-12-12 23:14:19
问题 What I want to do (in pseudo); <!-- As a resource --> <Storyboard x:Key="RepetitiveAnimation"> <DoubleAnimation .../> </Storyboard> <!-- In the templates --> <VisualStateManager> <VisualState x:Name="blah" Storyboard="{StaticResource RepetitiveAnimation}"/> </VisualStateManager> or even like; <VisualStateManager> <VisualState x:Name="blah"> <BeginStoryboard Storyboard="{StaticResource RepetitiveAnimation}"/> </VisualState> </VisualStateManager> What doesnt work; See above. You can do this in

Using VisualStateManager to start and stop Storyboards

末鹿安然 提交于 2019-12-12 18:09:17
问题 I have an animation that animates a Canvas by turning it 360 degrees indefinitely (it basically spins). What I want is for this animation to start when the control is shown and then stop when the control is hidden. I figured I could tie this in, somehow, to the VisualStateManager . I have seen an example of fading in and out controls here which could work but I just dont know how to use VSM to start and stop the storyboard <Canvas.Resources> <Storyboard x:Name="spinnerBoard"> <DoubleAnimation

How can I share a VisualStateManager between two (or more) XAML files?

醉酒当歌 提交于 2019-12-12 16:01:48
问题 We're writing a Prism based Silverlight application and we've got a whole bunch of pages in separate modules. The transition between the pages is handled via navigation events and each module has the following methods implemented to show the page when navigated to and hide it when navigated from: public void Show() { VisualStateManager.GoToState(this, "ShowState", true); } public void Hide() { VisualStateManager.GoToState(this, "HideState", true); } At the moment "ShowState" and "HideState"

Windows Phone - Disabled Button Background

妖精的绣舞 提交于 2019-12-12 15:14:47
问题 here I'm once more with another question about Windows Phone. I just created some custom buttons and use they as background on my buttons. I also created a grayed button to show as disabled button. But if I disable using the button1.isEnabled = false, the background disappear Searching on the net I found a way using a Style tag, but I never used before. I tried but, it's aways returns me a problem, can someone give me a example? My Code: <Button x:Name="btSalvar" Content="Salvar Cor" Margin=

Binding VisualState to the ViewModel in Universal Windows 10 Apps

为君一笑 提交于 2019-12-12 05:53:42
问题 I used to use a custom Blend behavior to bind an enum on the ViewModel to VisualState 's that were named the same as the enum enumerations. However after including references and then including the using s, it seems the Bahaviors SDK is not currently supported. What is the current best way to change VisualState in a MVVM way in a Windows 10 Universal App? 回答1: "Behavior SDK" can be included by right-clicking on References -> Add Reference -> Universal Windows -> Extensions -> Behavior SDK.

How to change style depending on screen size?

◇◆丶佛笑我妖孽 提交于 2019-12-12 03:44:52
问题 I would like to change the orientation of a StackPanel depending on the screen size. I've been following this answer but haven't got things working yet. Here's what I've got so far: <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="SharedVisualStates"> <VisualState x:Name="DefaultLayout"> <VisualState.StateTriggers> <AdaptiveTrigger MinWindowWidth="720" /> </VisualState.StateTriggers> <VisualState.Setters> <Setter Target="GuidesList.Style" Value="{StaticResource

Custom VisualState not being set in WinRT XAML

风格不统一 提交于 2019-12-11 21:56:52
问题 I'm trying to create a custom textbox in WinRT XAML. I want the textbox to highlight red when there is an error with the entered data. So first off I've modified the TextBox Temple and I've added a new VisualStateGroup (CustomStates - with HasError State) and I've also change the Focused group: <Style TargetType="TextBox"> .... <VisualStateGroup x:Name="CommonStates"> <VisualState x:Name="Focused"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BorderElement" Storyboard

WPF using VisualStateManager to animate panels in & out

冷暖自知 提交于 2019-12-11 04:44:32
问题 I'm hoping what I'm trying to do is possible using Visual States... What I want to do is have a button that toggles a stackPanel between two states: 'In' and 'Out'. I would then call VisualStateManager.GoToState on the button's click event, to toggle between the two states. The problem I've run into is I can't figure out how to attach states to the StackPanel. It won't let me using Expression Blend. So I'm stuck... Is there anyway to animate in and out this panel using VisualStateManager? (I