Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. Why do WPF storyboards lock/freeze target properties?

Why do WPF storyboards lock/freeze target properties?

Scheduled Pinned Locked Moved WPF
csharpwpfquestiontutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Josh Fischer
    wrote on last edited by
    #1

    Hi everyone. I might be missing something obvious, but after I run a simple WPF storyboard to animate an object's width, I am no longer able to change the width manually. I have created the simple example below to demonstrate my point. The width change done by the first button works before you animate with the second button, but not after. What am I missing here? How can I "unfreeze" my width property so I can set it again? XAML:

    <Canvas>
    <Button Click="Button_Click">
    Set width to 100
    </Button>

    <Button Canvas.Top="30"
        Animate width to 250
    <Button.Triggers>
        <EventTrigger RoutedEvent="Button.Click">
            <BeginStoryboard>
                <Storyboard>
                    <DoubleAnimation Storyboard.TargetName="RedRectangle" Storyboard.TargetProperty="Width" To="250" Duration="0:0:1" />
                </Storyboard>
            </BeginStoryboard>
        </EventTrigger>
    </Button.Triggers>
    </Button>
    
    <Rectangle Name="RedRectangle" Width="25" Height="25" Canvas.Top="70" Fill="Red" Stroke="Black" />
    

    </Canvas>

    C# code behind:

    private void Button_Click(object sender, RoutedEventArgs e)
    {
    RedRectangle.Width = 100;
    }

    Thanks in advance

    Josh Fischer

    J 1 Reply Last reply
    0
    • J Josh Fischer

      Hi everyone. I might be missing something obvious, but after I run a simple WPF storyboard to animate an object's width, I am no longer able to change the width manually. I have created the simple example below to demonstrate my point. The width change done by the first button works before you animate with the second button, but not after. What am I missing here? How can I "unfreeze" my width property so I can set it again? XAML:

      <Canvas>
      <Button Click="Button_Click">
      Set width to 100
      </Button>

      <Button Canvas.Top="30"
          Animate width to 250
      <Button.Triggers>
          <EventTrigger RoutedEvent="Button.Click">
              <BeginStoryboard>
                  <Storyboard>
                      <DoubleAnimation Storyboard.TargetName="RedRectangle" Storyboard.TargetProperty="Width" To="250" Duration="0:0:1" />
                  </Storyboard>
              </BeginStoryboard>
          </EventTrigger>
      </Button.Triggers>
      </Button>
      
      <Rectangle Name="RedRectangle" Width="25" Height="25" Canvas.Top="70" Fill="Red" Stroke="Black" />
      

      </Canvas>

      C# code behind:

      private void Button_Click(object sender, RoutedEventArgs e)
      {
      RedRectangle.Width = 100;
      }

      Thanks in advance

      Josh Fischer

      J Offline
      J Offline
      Josh Fischer
      wrote on last edited by
      #2

      Found the answer to my own question: FillBehavior="Stop" http://msdn.microsoft.com/en-us/library/aa970493.aspx

      Josh Fischer

      modified on Wednesday, December 10, 2008 10:23 AM

      U 1 Reply Last reply
      0
      • J Josh Fischer

        Found the answer to my own question: FillBehavior="Stop" http://msdn.microsoft.com/en-us/library/aa970493.aspx

        Josh Fischer

        modified on Wednesday, December 10, 2008 10:23 AM

        U Offline
        U Offline
        User 3376033
        wrote on last edited by
        #3

        Thank you! Phil

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups