html
<Storyboard x:Key="IconStoryboard">
<DoubleAnimation
Storyboard.TargetName="PackIconFileIcon"
Storyboard.TargetProperty="(iconPacks:PackIconFileIcons.RotationAngle)"
From="0"
To="360"
Duration="0:0:0.3"
/>
</Storyboard>
<ToggleButton x:Name="toggleBtn" VerticalAlignment="Top" Width="30" Height="30" Margin="0,0,0,0">
<iconPacks:PackIconFileIcons x:Name="PackIconFileIcon" Kind="Actionscript" />
</ToggleButton>
csharp
private void toggleBtn_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
_pressedPosition2 = e.GetPosition(this);
}
private void toggleBtn_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
if (Mouse.LeftButton == MouseButtonState.Released && _pressedPosition2 == e.GetPosition(this))
{
if (toggleBtn.IsChecked == true)
{
//ItemsCtrl.Visibility = Visibility.Visible;
var expandStoryboard = (Storyboard)FindResource("ExpandStoryboard");
expandStoryboard.Begin();
var IconStoryboard = (Storyboard)FindResource("IconStoryboard");
IconStoryboard.Begin();
}
else
{
var collapseStoryboard = (Storyboard)FindResource("CollapseStoryboard");
collapseStoryboard.Begin();
var IconStoryboard = (Storyboard)FindResource("IconStoryboard");
IconStoryboard.Begin();
//ItemsCtrl.Visibility = Visibility.Hidden;
}
}
}