//workaround to update CircleToolbarItem play/pause icon and text
 private void MainContext_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     if (e.PropertyName == "Playing")
     {
         string icon    = MainContext.Playing ? "images/pause.png" : "images/play.png";
         string text    = MainContext.Playing ? "Pause" : "Play";
         var    newItem = new CircleToolbarItem
         {
             Command = (ToolbarItems[2] as CircleToolbarItem).Command,
             Icon    = icon,
             Text    = text,
         };
         var th4 = ToolbarItems[3];
         var th5 = ToolbarItems[4];
         var th6 = ToolbarItems[5];
         ToolbarItems.RemoveAt(2);
         ToolbarItems.RemoveAt(2);
         ToolbarItems.RemoveAt(2);
         ToolbarItems.RemoveAt(2);
         ToolbarItems.Add(newItem);
         ToolbarItems.Add(th4);
         ToolbarItems.Add(th5);
         ToolbarItems.Add(th6);
     }
 }
Exemplo n.º 2
0
        void AddToolbarItem(string mainText, string subText, string icon)
        {
            CircleToolbarItem item = new CircleToolbarItem
            {
                Text            = mainText,
                SubText         = subText,
                IconImageSource = icon
            };

            ToolbarItems.Add(item);
            cntLabel.Text = "# of items :" + ToolbarItems.Count;
        }