.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

VisualStateManager: change a property before it starts animation?

Posted By:      Posted Date: September 04, 2010    Points: 0   Category :WPF
i realize that if we "animate" the Visibility property.. it uses the ObjectAnimationUsingKeyFrames animation to set the property after it transits to a new state... how can i change the property before it animates in the new state? i know there is the CurrentStateChanged and CurrentStateChanging event that i can use to set the property.. however... that is ok if you have 2 states.. but for my case i have a couple of states(in my case 7 states)... so if change the visibility in one of the states... the property doesn't switch back automatically when we switched to another state.... my thought of having 7 conditions to change the property just isn't the right way of doing... maybe.... it would be good if the VisualStateManager provides an attachedproperty to set on the specific ObjectAnimationUsingKeyframes to indicate whether the animation property is to be set at the start or at the end of the animation thanks

View Complete Post

More Related Resource Links

DataGridView>Edit Columns> Column Read Only property is unwilling to change

Hello, I am facing the following mystery: When changing the read only property of a column to false and reopening the "edit columns" window, it mysteriously turns back to true. Even when closing the designer and changing it in the designer code, the resulting execution does not allow edit, as well as when re-opening the designer you see true again.             this.numberDataGridViewTextBoxColumn1.DataPropertyName = "Number";             this.numberDataGridViewTextBoxColumn1.HeaderText = "Number";             this.numberDataGridViewTextBoxColumn1.Name = "numberDataGridViewTextBoxColumn1";             this.numberDataGridViewTextBoxColumn1.ReadOnly = true;//False is required We thought it might be related to data binding. rebinding the grid did not help as well. The is no other place in the code where it changes. Please advice, Thanks

how to change dynamically [Bbrowsable] attribute for a property at design time c#

hi,   how to change dynamically  [Browsable] attribute for a property  at design time c#

how to create property widget and change the properties of dragged-dropped UIelement in canvas in wp

I'm new in WPF development. I'd like to learn it. I'm curious and having problem in developing property widget for the UIElements. I want to change the properties of the dragged and dropped UIElement from the Property widget. How could I do this? I'd glad if any help is suggested. I've listbox and canvas. Elements from listbox can be dropped to the canvas. I'm trying to change the properties of the dropped element through a property widget. I don't know how to do this. I'd be grateful to any kind of support.   Regards, Binaya

How to change the value of a foreign key field/navigation property?

How can I change the value of a foreign key field?  E.g. in the Product list view instead of the value of the field Supplier.CompanyName I want to display the Supplier.Region. I searched my whole code to get a clue, googled for "change navigation property" and looked in the docs but unfortunately I did not find any hint. If you know where to find the answer, please let me know too the source of your knowledge!          

how to change button backcolor property on a form from a class file


Hello friends,

I am having a problem of updating the main form button backcolor property from another class. I have attahced the code. Please tell how can i rectify this problem.

PopUp is another class, in which i want that when ToolStripDropDown closes it change the form button BackColor from Orange to WhiteSmoke.


public partial class PopUp : ToolStripDropDown


        public PopUp()





        protected override void OnClosed(ToolStripDropDownClosedEventArgs e)


               Form1 f1 = new Form1();

              // f1._pushed = false;

       f1.Controls["button1"].BackColor = Color.WhiteSmoke;





It seems that this line works, i checked it using MessageBox it changes the backcolor property but it does not updated to the form displayed on the screen. 

Can anyone help me

Change a button's Foreground property using the VSM


I asked a question previously here and just realized I could probably rephrase it in a more compact way:

Using the visual state manager, how can I change the Foreground property on a button? That is, in the button's style "Pressed" Visual state, is there a way to reference the button's Foreground property (as opposed to properties on elements making up the button template itself)?

<Style TargetType="{x:Type Button}">
 <Setter Property="Template">

Change RSS FeedURL property dynamically


Hi ,

I'm using RSSViewer Web part.I have  a dropdown List in my page and it's having Feed URLs which has to pass values to RSS WP.RSS WP is OOTB and my requirement when i change the dropdown value RSS WP has to populate based on the value passed.

It might be Listview WP or a Dropdown....

Can we change the FeedURL for OOTB WP dynamically?

Thanks in advance.



Change parameter property after selecting another parameter


Hi guys, a question:

Is it possible to change a parameter's property after the uer has made a selection or filled in another parameter field? I'm using VS2005



- 3 parameter fields;  Country,Station,Carrier  all three are textfields and are allowed to stay 'blank'.

- When the user enters a Country-code in the 'Country' parameter field, the 'Carrier' parameter should become a required field.


I did some searching on the net, but haven't found the solution. I started to wonder if it's actually possible??

WPF 4 VisualStateManager sometimes does not change all properties to match the specified visual stat


I am using a visualstatemanager to animate a grid containing help information between a closed visualstate (collapsed and opacity 0) and an open visualstate (visible and opacity 1) and back in response to button clicks.  The behavior I am seeing is that normally this animation works fine.  However, intermittently the grid when animating to a closed state changes opacity to 0 but remains in a visible state (I have confirmed this using the Snoop tool).  In my app this prevents interaction with the button used to close the help information (as it is on the invisible gird) as well as with any of the other controls that appear on the user control underneath the help grid.

As you see from the control below this is all managed with declarative xaml and does not involve complex prism or other eventing logic.

In my App.xaml.cs file I am handling the AppDispatcherUnhandledException event, and no unhandled exception is being trapped, so I can't find an exception that is causing the issue.

Here's the declaration of the help control, including the button that triggers the close animation.  Instance of this control are used throughout my application for various features.

<UserControl x:Class="Ihi.LeadRetrieval.Client.Views.HelpView"

Change animation properties during animation


Hello, what is the proper way to change the DoubleAnimation.To value when the animation is running?

I have tried databinding the DoubleAnimation.ToProperty but it does not seem to work either once the clock is running.

Thanks, Jan

SmallChange is a property of ScrollBar,But it can not Cause change of ScrollBar.


I expect ScrollBar value  changed by 1, so I set SmallChange is 1,But it is invalid to change value about ScrollBar.


SSIS Dynamic Flat Files (Can't get ConnectionString property to dynamically change)


Hi all,

I am trying to do what many have already tried.  I wish SSIS was made more user friendly in this perspective, but I am trying to have SSIS read a folder directory, and get all the files based on a condition that I've specified.

I was following this link:  http://consultingblogs.emc.com/jamiethomson/archive/2005/05/30/SSIS_3A00_-Enumerating-files-in-a-Foreach-loop.aspx

So I have a For-Each loop, and within it, I have my Data Flow Task which includes a Flat File Source Connection.  The problem is, how do I pass that information to the connection string?  I can see the connection string in the XML file, but for some reason, I cannot access the property "ConnectionString".  The first property I see when I go to the expressions editor is "DelayValidation."  Furthermore, I've seen documents online where it there is a "connectionString" property for the Flat File Source Connection.  Well, I see no such property.

Any help with specific steps would be greatly appreciated.  Also, once I've figured that part out, I need to be able to move the files to another location after they have been put in the SQL Server DB.  This was much easier in coding a vb.net application.

How do I automaticaly change one property based on another with MVVM?



I have a grid connected to a ViewModel class with two properties, public Address SelectedAddress and public ObservableCollection<Address> Addresses.

Address has, among other things, int? PersonID and int? CompanyID. My validation code in the Model checks that one of them is filled, but not both.

How do I set up code in the grid or ViewModel so that whenever PersonID is filled, CompanyID is automatically set to null, and the other way?



How to change default category for the Text Box Property NUMBER across multiple textboxes


I'm using SSRS R8 and have several reports with numerous NUMERIC textboxes.  The default NUMBER category that SSRS applies is "Default", which applies no formating to the number values shown in the textbox.  When the report executes, it displays these values with 4 decimal places (e.g. 123.1234).  The customer requires 2 decimal places (e.g. 123.12). 

This can be easily fixed by changing the category for the NUMBER Text Box Property from "Default" to "Number", with "Decimal Places" set to 2.

The trouble with doing it this way is that each report has over a hundred such textboxes (there are 15 such reports), and to change each textbox individually would be timeconsuming and error prone.  The intuitive way to do this would be to select multiple textboxes that I want to set the NUMBER category for, right click, select Text Box Properties, and set the NUMBER category accordingly.  However when I right click the multi-selected text boxes, I see the Text Box Properties option greyed out.

Is there a different way to do this?

Silverlight Simple Animation

Silverlight has several built in techniques for animating controls. Many of these technologies are particularly useful for creating simple animations meant to decorate a web page with eye catching movement that draws the reader's attention. In this post I will skip over these decorative technologies, and instead show how to create a simple animation using a technique similar to those used in many games.

WPF / Silverlight tutorial: Visibility property and binding

Visibility property is a very powerful and yet often overlooked property available in both WPF and Silverlight. It enables you to set Visibility of certain UIElement objects to different states like: Visible, Collapsed and Hidden (not supported by Silverlight). This tutorial shows you how to use it and how to bind to Visibility property

abstract away the source of the connection string using a class with a static property.

ASP.NET provides a configuration system we can use to keep our applications flexible at runtime. In this article we will examine some tips and best practices for using the configuration system for the best results.

The element of a web.config file is a place to store connection strings, server names, file paths, and other miscellaneous settings needed by an application to perform work. The items inside appSettings are items that need to be configurable depending upon the environment, for instance, any database connection strings will change as you move your application from a testing and staging server into production.

Let's abstract away the source of the connection string using a class with a static property.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend