Skip to content

Special click effects can be achieved with the help of floating blocks.

cs
public class FloatingBlock : Control

Attributes

PropertyDescriptionDefault ValueRemarks
ToXX-axis disappearing position0
ToYY-axis disappearing position-100
DurationAnimation duration2s
HorizontalOffsetHorizontal Offset0
VerticalOffsetVertical Offset0
ContentTemplateFloating Content Template
ContentFloating Content

Case

xml
<StackPanel Margin="32" VerticalAlignment="Center">
    <Button hc:IconElement.Geometry="{StaticResource ThumbsUpGeometry}" Width="180">
        <hc:FloatingBlock.ContentTemplate>
            <DataTemplate>
                <Path Data="{StaticResource ThumbsUpGeometry}" Fill="{DynamicResource DangerBrush}" Width="16" Height="16"/>
            </DataTemplate>
        </hc:FloatingBlock.ContentTemplate>
    </Button>
    <Button Content="Good" hc:FloatingBlock.Content="Good" Width="180" Margin="0,10,0,0"/>
    <Button hc:IconElement.Geometry="{StaticResource ThumbsUpGeometry}" Width="180" Margin="0,10,0,0" hc:FloatingBlock.Duration="0:0:1" hc:FloatingBlock.VerticalOffset="-20" hc:FloatingBlock.ToX="50" hc:FloatingBlock.ToY="-80">
        <hc:FloatingBlock.ContentTemplate>
            <DataTemplate>
                <Path Data="{StaticResource ThumbsUpGeometry}" Fill="{DynamicResource DangerBrush}" Width="16" Height="16"/>
            </DataTemplate>
        </hc:FloatingBlock.ContentTemplate>
    </Button>
</StackPanel>

FloatingBlock

Released under the MIT License.