This project is read-only.

Tooltip in real time

Mar 21, 2009 at 7:05 PM
Hello,

I try to apply the tooltip presented in the sample "Tooltip" of the last release but with real time data.

Here is the tooltip that I want to use:
EnumerableDataSource<double> yDataSource;
(...)
yDataSource.AddMapping(ShapeElementPointMarker.ToolTipTextProperty,
                Y => String.Format("Value is {0}", Y));

I need the function AddMapping(..) of an Enumerable dataSource but at the same time I need the AppendAsync(...) function of an ObservableDataSource for real time plot.
What is the best way to solve this problem?
I wish I can add to the ObservableDataSource:
  • a private readonly List<Mapping<T>> mappings = new List<Mapping<T>>();
  • a method :  public void AddMapping(DependencyProperty property, Func<T, object> mapping)
            {
                if (property == null)
                    throw new ArgumentNullException("property");
                if (mapping == null)
                    throw new ArgumentNullException("mapping");

                mappings.Add(new Mapping<T> { Property = property, F = mapping });
            }
But I can not touch the code of (src -> DynamicDataDisplay) as it is read only.
How can I modify the open source code and create my dll?

Thanks,
Kamel
Mar 24, 2009 at 12:29 PM
Edited Mar 24, 2009 at 12:35 PM
Hello! 

Currently ObservableDataSource and EnumerableDataSource are similar in their functionality. You can emulate ObservableDataSource using EnumerableDataSource and passing to it ObservableCollection with your data. Also you can emulate AppendAsync(...) method by calling its contents from outside - it is rather simple:

dispatcher.Invoke(DispatcherPriority.Normal,
new Action(() =>
{
collection.Add(item);
RaiseDataChanged();
})); 

where dispatcher can be Dispatcher of any your's WPF controls. 

Yours,
Mikhail Brinchuk.
Mar 24, 2009 at 9:12 PM
Hi Mikhail,

Please see the last post concerning the discussion "major bug - urgent (please)!".

Thanks,
Kamel



Mar 27, 2009 at 9:46 AM
Hi Kamel,

I've posted a reply in that discussion.

Mikhail.