visualstatemanager

Proper way in MVVM to drive visual states

こ雲淡風輕ζ 提交于 2019-12-06 04:49:23
Given a content presenter that can display one of 4 different application pages, and I want to fade/otherwise animate a transition between pages based on view model state. Ideally I'd like to have these all defined within a DataTemplate, and then trigger transitions based on an enum from the view model, so that when some enum representing state changes, the transitions trigger to the appropriate page. Is there a known best practice to handle things like this? Immediately coming to mind is the possibiltiy to use Enter and Exit actions on data triggers to play storyboards, but this definately

VisualState in abstract control

被刻印的时光 ゝ 提交于 2019-12-05 21:23:23
I have an abstract BaseControl that contains dependency properties as well as default style and VisualState. I would like to use these VisualState in inherited Controls. I understand that setting the Template of the inherited control does not enable the VisualState to access the UIElement that it needs to update. How should I proceed to properly use these VisualStates? (copy paste the VisualState in the XAML of each inherited control is not an option for me). Is it possible to access the Template of a base control from an inherited control? Is there any in code solution? Any help is greatly

VisualStateManager can't generate transitions for ThicknessAnimations

时间秒杀一切 提交于 2019-12-05 12:09:42
I have the following Visual States defined: <VisualStateManager.VisualStateGroups> <VisualStateGroup Name="EditStates"> <VisualStateGroup.Transitions> <VisualTransition GeneratedDuration="0:0:2"/> </VisualStateGroup.Transitions> <VisualState Name="Editing" /> <VisualState Name="Normal"> <Storyboard> <ThicknessAnimation Storyboard.TargetName="ViewBorder" Storyboard.TargetProperty="Margin" To="0" Duration="0"/> <DoubleAnimation Storyboard.TargetName="Header" Storyboard.TargetProperty="(FrameworkElement.LayoutTransform).(ScaleTransform.ScaleY)" To="0" Duration="0"/> <ColorAnimation Storyboard

Handling Orientation in Windows 8.1 Store app

為{幸葍}努か 提交于 2019-12-04 15:58:33
I am making a Win Store App, and facing the issue to handle orientation. There is a grid, I want to modify the design of it when the orientation is changed. The stack Panels in both the sides (in Landscape View) should goto Top and Bottom in Portrait View. Currently I have created two grids with all the controls and adjust them according to the orientation, and switching the visibility property, using VisualStateManager. But I want to achieve this with a single grid, any suggestion will be a great help for me. The below image is the concept design of the app: Doing this with a single Grid is

UWP VisualStateManager PointerOver does not work

冷暖自知 提交于 2019-12-04 05:34:39
问题 I am mimicking the behavior of Groove Music, which displays a drop shadow effect when mouse hovers on an album cover (in my code it's the entire DataTemplate). But My VisualStateManager doesn't seem to work. Any ideas? I have implemented that programmatically but I want to use xaml to do that for practice. ---Update--- Changing Stackpanel to Grid still doesn't make things work. <GridView Grid.Row="1" Margin="10" IsItemClickEnabled="True" ItemsSource="{x:Bind Albums}"> <GridView.ItemTemplate>

How to wait for state changing transition to finish in Silverlight 4?

白昼怎懂夜的黑 提交于 2019-12-04 00:38:28
I need to change state of a control and then do some action. To be specific, I want to run an animation before a control is hidden. I would like to do something like that: VisualStateManager.GoToState(control, "Hidden", true); // wait until the transition animation is finished ParentControl.Children.Remove(control); The problem is that the transition animation is run asynchronously and thus the control is removed from the visual tree right after the animation is started. So how do I wait for the animation to finish? You can attach a Storyboard.Completed event handler to the Storyboard or

How to go back to “Base” state using VisualStateManager?

China☆狼群 提交于 2019-12-03 23:41:27
问题 I know we can use VisualStateManager.GoToState(this,"SomeState1",true); to enter into SomeState1 , but now how to go back to the base state, like no state, the state where the control was loaded in. VisualStateManager.GoToState(this,"base",true); // OR VisualStateManager.GoToState(this,"",true); // OR VisualStateManager.GoToState(this,null,true); The problem is if there is no such way to go back to the initial or base state then I will have to always create a first state and in the contructor

VisualStateManager — showing mouseover state when control is focused

守給你的承諾、 提交于 2019-12-03 06:21:00
问题 I am creating a WPF button using Windows 8 styling (formerly metro). I would like the focused state of the button to show with a solid background. When the mouse is over the control, I would like th background to darken slightly to create the visual cue that the button can be clicked. Unfortunately, the XAML I've written below does not work. The focused state shows correctly, but when the mouse is over the control, the background does not darken as I would like it to. <Color x:Key=

VisualStateManager — showing mouseover state when control is focused

柔情痞子 提交于 2019-12-02 19:44:51
I am creating a WPF button using Windows 8 styling (formerly metro). I would like the focused state of the button to show with a solid background. When the mouse is over the control, I would like th background to darken slightly to create the visual cue that the button can be clicked. Unfortunately, the XAML I've written below does not work. The focused state shows correctly, but when the mouse is over the control, the background does not darken as I would like it to. <Color x:Key="DoxCycleGreen"> #FF8DC63F </Color> <!-- Soft Interface : DoxCycle Green --> <Color x:Key="DoxCycleGreenSoft">

UWP VisualStateManager PointerOver does not work

血红的双手。 提交于 2019-12-02 09:06:21
I am mimicking the behavior of Groove Music, which displays a drop shadow effect when mouse hovers on an album cover (in my code it's the entire DataTemplate). But My VisualStateManager doesn't seem to work. Any ideas? I have implemented that programmatically but I want to use xaml to do that for practice. ---Update--- Changing Stackpanel to Grid still doesn't make things work. <GridView Grid.Row="1" Margin="10" IsItemClickEnabled="True" ItemsSource="{x:Bind Albums}"> <GridView.ItemTemplate> <DataTemplate x:DataType="data:GridAlbumView"> <Grid Width="180" Height="240" Margin="10"> <Grid