visualstatemanager

Automaticly Change VisualState in Silverlight

If you create a simple button and then choose Edit Template -> Edit a Copy, Blend will automatically generate a style area, along with all the button states (MouseEnter, MouseLeave, Pressed, etc). No where in the generated code does it say that on a "MouseOver" event, change the state to "MouseOver", but it still manages to work! How d...

Disabling Button with custom Content in Silverlight?

Hi there, 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 ...

Visual State Manager in WPF not working for me

Hi In a wpf project I have this XAML code <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" xmlns:ic="clr-...

WPF Visual States and the transitions between them

I'm trying to define many different states in my app (around 7 in my case) and I have defined each one of them with a "Default Transition" of zero seconds, but the animation that accompanies each state goes for 1 second. When I fire up my app I have a button than goes through the states one by one, when I go "State1" -> "State2" it look...

Silverlight 4.0 VisualStateManager

Can anyone please help me or is there anything I miss out? the visualstate is not triggered xmlns:swi="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:esi="clr-namespace:Expression.Samples.Interactivity;assembly=Expression.Samples.Interactivity" xmlns:mei="clr-namespace:Microsoft.Ex...

WPF 4 VisualStateManager Problem

Testing to see if our 3.5 WPF application can be upgraded to 4.0. We make use of the WPF Toolkit - in particular the visual state manager. We have some custom controls that extend existing controls and have styling for the Invalid state. We also have a control template that we use for Validation.ErrorTemplate. In 3.5 both the Invalid...

MVVM visualstatemanager and focus

Using Silverlight 4. I have two visual states for my control. I want to change the focus from one textbox to another when the states change. What is the best way to do this using MVVM? I was hoping to use the visualstatemanager to do it or a behavior... but I have not figured out a way. ...

Can I reference Storyboard resources in XAML defind Visual States?

I have six different objects with their own Visual State Managers. The Focused state of each object is the same. I want to define a single Focused State Storyboard resource and reference it in each of the 6 Focus Visual states. Can this be done? Here's my code (all in the same UserControl.Resources): <Storyboard x:Key="FocusedState"> ...

VisualState inheritence in Silverlight

I'm writing a control that inherits from a RadioButton and doesn't do anything more spectacular than display an image and hide the default circle. One thing I haven't been able to find out about is if I have to re-implement all the VisualStates again in my ControlTemplate, or can I simply put them as an empty element and they're inheri...

WPF: Can I use VisualStateManager to change alignment?

Hi, I've got this "object-stack" - Window --- Grid (VerticalAlignment = Stretch) ----- Border (VerticalAlignment = Stretch OR Top) The Border a primitive UserControl right now to keep things simple for me. I'd like to be able to use the VisualStateManager to toggle the VerticalAlignment-property of the Border, so that the "Normal-stat...

MVVM with animations (should I use VisualStateManager?)

I've got a View.xaml with the following set in Resources-section: <DataTemplate DataType="{x:Type ViewModels:MyFirstViewModel}"> <Views:MyFirstView Content="{Binding}" /> </DataTemplate> <DataTemplate DataType="{x:Type ViewModels:MySecondViewModel}"> <Views:MySecondView Content="{Binding}"/> </DataTemplate> In the content of ...

WPF: VisualStateManager not working

Hi, I'm trying to figure out how the VisualStateManager works but I cannot do it. I want to do this: I have some TextBoxes where the user can enter his name, adress, ... and I'm doing a validation and I didn't want to do that with a validationrules-binding in XAML. I'm using MVVM-pattern and some code of my viewmodel does it. So I'm bi...

Setting a Visual State from a data bound enum in WPF

Hey all, I've got a scenario where I want to switch the visiblity of 4 different content controls. The visual states I have set opacity, and collapsed based on each given state (See code.) What I'd like to do is have the visual state bound to a property of my View Model of type Enum. I tried using DataStateBehavior, but it requires tr...

Proper way in MVVM to drive visual states.

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 representi...

Rotating states in a Blend 4 VisualStateManager based on timer events?

I'm building a Silverlight 4 UserControl in Blend which has three VisualStates. I would like to have the states change from the first to the second state after a delay of a few seconds, second to third after a few more seconds, third to first after another delay, and continue rotating like that. Essentially, this is a very primitive ...

VisualStateGroup Triggering Animation in Another VisualStateGroup

There's something fundamental about VisualStateGroups that I'm not understanding. Everything I've read has led me to believe that they are orthogonal. That is, a state change in one group won't affect other groups. Indeed, they would be rather pointless if this were not the case. However, in an attempt to understand some odd behavior I ...

Imposing minimum times spent in a given visual state

I'm wanting to ensure a control remains in a certain state for a minimum amount of time. The control has two states: Loading and Loaded. The Loading state displays an animation and the Loaded state displays the data. There is a fade in/out transition between the two states. However, the problem is sometimes the data loads so quickly tha...

Inherit from visual statemanager

I have two user controls. One inside the other. I want to have a mouseover visual state in each. I want to change the visualstate to mouseover on the parent and also have it fire for the child. What is the best way to accomplish this? ...

Modify Silverlight Resource in VisualState

I am wondering if there is an easy way to modify some kind of shared resource (i.e. a Brush) of a control between different VisualStates. For example, I would like to define a Brush to use as both the Background of a Border and the Fill of a different Rectangle. In a different VisualState I would like to change this background Brush in o...

Referring to a brush resource in a VisualState ColorAnimation

I'm trying to style the Calendar control and need the buttons to adopt the colors we already have defined as named resources. But the storyboards require colors in the ColorAnimation, and I'm not sure how to use a brush there. For example, I need to turn this <VisualState x:Name="MouseOver"> <Storyboard> <ColorAnimation Duration="00...