visualstatemanager

Start a VisualState transition from XAML

蓝咒 提交于 2020-01-04 04:20:09
问题 In a user control (or whatever), we all know that the VisualStateManger can be used in code to start a transition, or animation, like so: if (target.IsLocked) { VisualStateManager.GoToState(this, "Locked", true); } else if (target.IsBroken) { VisualStateManager.GoToState(this, "Broken", true); } else { VisualStateManager.GoToState(this, "Normal", true); } However, there seems to be very little or no information about triggering these type of animations from XAML. Could a DataTemplate or

WPF visual state manager in Blend 2 sp1

流过昼夜 提交于 2020-01-03 15:33:56
问题 Can anyone explain to me how to get the visual state manager to work with a WPF application? It's just been added to the new wpftoolkit. I installed it as told, but even the sample doesn't show the VSM. In silverlight it work, but not in WPF. If installed the latest Blend 2 and updated with the SP1. 回答1: This might also help: http://blogs.msdn.com/expression/archive/2008/10/30/blend-2-sp1-wpf-toolkit-visual-state-manager-for-wpf.aspx 回答2: rudigrobler, you've got me thinking... There should be

WPF visual state manager in Blend 2 sp1

牧云@^-^@ 提交于 2020-01-03 15:32:29
问题 Can anyone explain to me how to get the visual state manager to work with a WPF application? It's just been added to the new wpftoolkit. I installed it as told, but even the sample doesn't show the VSM. In silverlight it work, but not in WPF. If installed the latest Blend 2 and updated with the SP1. 回答1: This might also help: http://blogs.msdn.com/expression/archive/2008/10/30/blend-2-sp1-wpf-toolkit-visual-state-manager-for-wpf.aspx 回答2: rudigrobler, you've got me thinking... There should be

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

痞子三分冷 提交于 2020-01-01 08:39:14
问题 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

How can I animate a property dynamically in a Silverlight 4 UserControl?

女生的网名这么多〃 提交于 2019-12-25 04:43:43
问题 I've run into a puzzling limitation in a Silverlight 4 UserControl. What I'm trying to achieve is to have a panel, which slides out from a minimised state when a button is pressed, but the title bar of it should be draggable with which this maximised state can be resized. What I've done for the sliding out is to animate the MaxHeight property of the parent Grid of this panel which works quite well even with no hardcoded Height for the panel, but I don't know how can I make this dynamic.

Disabling Button with custom Content in Silverlight?

爱⌒轻易说出口 提交于 2019-12-25 02:57:15
问题 What is the easiest way to create a Silverlight Button with custom Content which knows how to ' look ' disabled? I.e. if you set IsEnabled="False" it will look greyed out. The custom Content will be dead simple, text and an image. I have done this before in a WPF application quite easily by setting the Content to a StackPanel containing a TextBlock and an Image. I then implemented a Style Trigger on the Image to change it to a greyed out version when it wasn't enabled. The text changed colour

Silverlight: VisualStateManager.GetVisualStateGroups doesn't, How can I get them?

假如想象 提交于 2019-12-24 01:51:34
问题 I've tried using VisualStateManager.GetVisualStateGroups in the OnAttached override of my custom behavior, as well as in an event handler added to AssociatedObject.Loaded event in that behavior. Both times I get an empty list. Is there another way to get the visual state groups defined for a control, or another event handler I should attach to? Be for it's asked, yes, the control has VisualStateGroups and VisualStates . 回答1: Usually the VisualStateGroups attached property is attached to the

Proper way in MVVM to drive visual states

冷暖自知 提交于 2019-12-22 18:50:10
问题 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

Handling Orientation in Windows 8.1 Store app

风流意气都作罢 提交于 2019-12-21 21:37:21
问题 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

In a button's control template, how can I set the color of contained text?

半腔热情 提交于 2019-12-21 08:00:17
问题 Using Silverlight 4 & WPF 4, I'm trying to create a button style that alters the text color of any contained text when the button is mouseover'd. Since I'm trying to make this compatible with both Silverlight & WPF, I'm using the visual state manager: <Style TargetType="{x:Type Button}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Button"> <Border x:Name="outerBorder" CornerRadius="4" BorderThickness="1" BorderBrush="#FF757679"> <VisualStateManager