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. Other Discussions
  3. Clever Code
  4. Animated dots? No problem!

Animated dots? No problem!

Scheduled Pinned Locked Moved Clever Code
helpquestion
5 Posts 3 Posters 15 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.
  • L Offline
    L Offline
    Lutoslaw
    wrote on last edited by
    #1

    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

    T 1 Reply Last reply
    0
    • L Lutoslaw

      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

      T Offline
      T Offline
      Tech Code Freak
      wrote on last edited by
      #2

      :omg: :omg: :omg: :omg:

      L P 2 Replies Last reply
      0
      • T Tech Code Freak

        :omg: :omg: :omg: :omg:

        L Offline
        L Offline
        Lutoslaw
        wrote on last edited by
        #3

        Is something wrong in my code? IMHO it's very straightforward.

        Greetings - Jacek

        1 Reply Last reply
        0
        • T Tech Code Freak

          :omg: :omg: :omg: :omg:

          P Offline
          P Offline
          Pavan Navule
          wrote on last edited by
          #4

          :laugh: :laugh: :laugh: :laugh: :laugh:

          L 1 Reply Last reply
          0
          • P Pavan Navule

            :laugh: :laugh: :laugh: :laugh: :laugh:

            L Offline
            L Offline
            Lutoslaw
            wrote on last edited by
            #5

            OK I get it. It took me long though. :(( :(( :(( :(( :laugh:

            Greetings - Jacek

            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