Reputation: 525
Before I ask my question let me try to explain what I am trying to accomplish. In my WPF window I have a button in the middle of the window. When that button is clicked I want to have a sub menu slide out from the button and expand with sub menu buttons.
If you think I might be approaching this the wrong way please, I'm open to suggestions. I am very new to WPF as I'm trying to transition from WinForms.
From my searches I have found how to use storyboards or doublAnimation to resize buttons and shapes. I so far have not been able to find how to do this with a canvas. I have found how to store the canvas outside of the window ans slide it in, but i want it to collapse into the trigger button.
The closet example I think I have found was this article from MSDN https://msdn.microsoft.com/en-us/library/ms753135%28v=vs.100%29.aspx?f=255&MSPPError=-2147217396.
I am currently just using that entire example from MSDN to just attempt to learn the basics of animating canvas size. I thought once I learn how to do that in a simple environment, then I could apply it to my application.
I modified the XML to point towards my canvas (name="Can") but I am returned an error
"Can is not supported in a Windows Presentation Foundation project."
My project is a copy/paste of the WPF example on the MSDN webpage linked above. I have only modified the DoubleAnimation element of the first button to this
<EventTrigger RoutedEvent="Button.Click">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="Can"
Storyboard.TargetProperty="(Can.Width)"
To="500"
Duration="0:0:3"
AutoReverse="true" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
Any Help would be most appreciated
Upvotes: 0
Views: 55
Reputation: 7029
Try Storyboard.TargetProperty="(Canvas.Width)"
. There is not a Can
type in WPF with a Width
property.
Upvotes: 1