コード例 #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
ファイル: LabelProviderBase.cs プロジェクト: nwelsheimer/NBS
 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
ファイル: LabelProviderBase.cs プロジェクト: nwelsheimer/NBS
        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
ファイル: LabelProviderBase.cs プロジェクト: nwelsheimer/NBS
 protected virtual string GetStringCore(LabelTickInfo <T> tickInfo)
 {
     return(tickInfo.Tick.ToString());
 }