visualstatemanager

How to make a specific GoToStateAction-with-DataTrigger run when element is loaded

I have a DataTemplate. It has two visual states - Expanded, Collapsed. I added 2 GoToStateAction-s. The first one goes to the Expanded state when a data context property becomes True, and the second one goes to the Collapsed state when that same property becomes False. A Checkbox is part of the template and bound to that property. So wh...

How can I control the SpeedRatio of a Storyboard inside a VisualState?

Given a Storyboard started by the VisualStateManager as part of a ControlTemplate, how would I adjust the SpeedRatio of that animation based on property changes of the control? <ControlTemplate> <Grid> <VisualStateManager.VisualStateGroups> <VisualStateGroup> <VisualState> <Storyboard Name="SpinningThing" ...

How can I add additional bindable visual state groups to a button?

I need to extend a button control to add some additional, bindable, visual states. What I would like to create is an additional boolean property, to bind to, that will create a simple visual state change on the button. For this example, it could just be an additional border which changes colour according to the boolean value. All the ...

Best way to propagate VisualState changes

Hi, I am currently facing a scenario that I am unsure what is the best way to handle. Scenario: ControlA has 2 two custom visualstates, let’s call them “StateOn” and “StateOff”. I now apply a template on ControlA, let’s call it “templateA”. “templateA” has one control under it of type ControlB (who’s unaware of StateOn/Off). Control...

changing tooltip in visualstatemanager

Hi, i want to be able to change the tooltip on Checked and Unchecked, i tried: <VisualState x:Name="Checked"> <Storyboard> <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="ToolTipService.ToolTip" Storyboard.TargetName="btn"> <DiscreteObjectKeyFrame KeyTime="0"> <DiscreteObjec...

changing tooltip based on state in silverlight

Hi, I wanted to be able to change the tooltip on checked and unchecked through the visualstatemanager, this is what i got so far but it doesn't work: <VisualState x:Name="Checked"> <Storyboard> <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="ToolTipService.ToolTip" Storyboard.TargetName="btn"> <Discret...

GoToState not working on controltemplated usercontrol based on combobox

I'm trying to create a custom combobox that shows a loading animation when a bool property is set on it (e.g. IsLoading). I've created a control template in Blend based on the combobox, and added a textblock inside the togglebutton template. In the code behind I'm calling VisualStateManager.GoToState but it always returns false. I was t...

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

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

Animating same property from mutually exclusive VisualStateGroups

My question is simply: is it even possible? Suppose I want to style a ListBoxItem such that it has a black foreground by default, blue when selected, and red when the mouse is over it. I ended up with something like this: <!-- assume the default foreground color is black --> <ControlTemplate TargetType="ListBoxItem"> <Grid Backgrou...

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

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

Silverlight - Smooth visibility change

I have a Grid with 2 rows, where the second has Visibility.Collapsed by default. I want it to change to Visibility.Visible on MouseEnter on the Grid and back on MouseLeave. That's simple and done. However, I would like the transition between Visible and Collapsed to not be instant but smooth. I believe I can do this somehow with the Vi...

How can I cause a Button within a StackPanel to fade in when hovering over the StackPanel?

I have a ListBox containing a StackPanel which contains a CheckBox and a Button. I want the button to fade in when the mouse is hovering over the StackPanel. I would like to do this declaratively using XAML if possible. I have attempted this with the following code to no avail. Any thoughts as to what I am doing wrong? <UserControl...

VisualStateManager does nothing (silverlight)

Hi, I am building a custom control using studio 2010 and silverlight 4. I am trying to use the visual state manager. With the following xml: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows" xmlns:x="http://schemas.microso...

VisualState that starts collapsed interfers with other animations in WPF .NET 4

I am using .net 4, vs2010 and have created a user control that needs to start collapsed and transparent (opacity 0) and become visible and opaque in response to a button click. <UserControl x:Class="Ihi.LeadRetrieval.Client.Views.HelpView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" ...

Changing VisualState of a control by binding it with some property of ViewModel.

Considering the code below: xmlns:interactivity="clr-namespace:Microsoft.Expression.Interactivity;assembly=Microsoft.Expression.Interactivity" ... <ToggleButton IsChecked="{Binding Path=IsGlobalControllerAttached}" Command="{Binding Path=AttachDetachGlobalControllerAction}" ToolTip="{Binding Path=GlobalControllerToolTip}" Visibility...