Animated dots? No problem!
-
A simple "Dots" control:
Code behind:
(...)
public static DependencyProperty DotCountProperty = DependencyProperty.Register("DotCount", typeof (int), typeof (Dots),
new PropertyMetadata(3, OnDotCountChanged));public static DependencyProperty AnimateProperty = DependencyProperty.Register("Animate", typeof (bool), typeof (Dots),
new PropertyMetadata(true));public bool Animate
{
get { return (bool) GetValue(AnimateProperty); }
set { SetValue(AnimateProperty, value); }
}
private static void OnDotCountChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var dotContainer = (StackPanel)((Dots) d).FindName("dotsContainer");
dotContainer.Children.Clear();
var newValue = (int) e.NewValue;
for (int i = 0; i < newValue; i++)
{
dotContainer.Children.Add(new TextBlock
{
Text = ".",
Margin = new Thickness(1, 0, 1, 0)
});
}
}public int DotCount
{
get { return (int) GetValue(DotCountProperty); }
set { SetValue(DotCountProperty, value); }
}
(...)Usage:
<BooleanToVi
-
A simple "Dots" control:
Code behind:
(...)
public static DependencyProperty DotCountProperty = DependencyProperty.Register("DotCount", typeof (int), typeof (Dots),
new PropertyMetadata(3, OnDotCountChanged));public static DependencyProperty AnimateProperty = DependencyProperty.Register("Animate", typeof (bool), typeof (Dots),
new PropertyMetadata(true));public bool Animate
{
get { return (bool) GetValue(AnimateProperty); }
set { SetValue(AnimateProperty, value); }
}
private static void OnDotCountChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var dotContainer = (StackPanel)((Dots) d).FindName("dotsContainer");
dotContainer.Children.Clear();
var newValue = (int) e.NewValue;
for (int i = 0; i < newValue; i++)
{
dotContainer.Children.Add(new TextBlock
{
Text = ".",
Margin = new Thickness(1, 0, 1, 0)
});
}
}public int DotCount
{
get { return (int) GetValue(DotCountProperty); }
set { SetValue(DotCountProperty, value); }
}
(...)Usage:
<BooleanToVi
:omg: :omg: :omg: :omg:
-
:omg: :omg: :omg: :omg:
-
:omg: :omg: :omg: :omg:
:laugh: :laugh: :laugh: :laugh: :laugh:
-
:laugh: :laugh: :laugh: :laugh: :laugh: