예제 #1
0
        public override UIElement[] CreateLabels(ITicksInfo <int> ticksInfo)
        {
            var ticks = ticksInfo.Ticks;

            UIElement[] res = new UIElement[ticks.Length];

            var tickInfo = new LabelTickInfo <int> {
                Info = ticksInfo.Info
            };

            for (int i = 0; i < res.Length; i++)
            {
                int tick = ticks[i];
                tickInfo.Tick = tick;

                if (0 <= tick && tick < collection.Count)
                {
                    string text = collection[tick].ToString();
                    res[i] = new TextBlock
                    {
                        Text    = text,
                        ToolTip = text
                    };
                }
                else
                {
                    res[i] = null;
                }
            }
            return(res);
        }
예제 #2
0
 protected void ApplyCustomView(LabelTickInfo <T> info, UIElement label)
 {
     if (CustomView != null)
     {
         CustomView(info, label);
     }
 }
예제 #3
0
        public override UIElement[] CreateLabels(ITicksInfo <T> ticksInfo)
        {
            var ticks = ticksInfo.Ticks;
            var info  = ticksInfo.Info;

            LabelTickInfo <T> tickInfo = new LabelTickInfo <T>();

            UIElement[] res = new UIElement[ticks.Length];
            for (int i = 0; i < res.Length; i++)
            {
                tickInfo.Tick = ticks[i];
                tickInfo.Info = info;

                string text = GetString(tickInfo);

                res[i] = new TextBlock
                {
                    Text    = text,
                    ToolTip = ticks[i].ToString()
                };
            }
            return(res);
        }
예제 #4
0
        protected virtual string GetString(LabelTickInfo <T> tickInfo)
        {
            string text = null;

            if (CustomFormatter != null)
            {
                text = CustomFormatter(tickInfo);
            }
            if (text == null)
            {
                text = GetStringCore(tickInfo);

                if (text == null)
                {
                    throw new ArgumentNullException(Properties.Resources.TextOfTickShouldNotBeNull);
                }
            }
            if (LabelStringFormat != null)
            {
                text = String.Format(LabelStringFormat, text);
            }

            return(text);
        }
예제 #5
0
 protected virtual string GetStringCore(LabelTickInfo <T> tickInfo)
 {
     return(tickInfo.Tick.ToString());
 }