TemplateValuePresenter

I want to show my x axis at a different scale than what is actually used to plot my data (conversion MHz at the time).  It seems that TemplateValuePresenter is what I need but I can't find any documentation on this topic.  I can get this to work using 2 axes and hiding one of them, but I feel like this is a bit of a hack solution.  Is there documentation on TemplateValuePresenter?  Specifically, I want to know how to access the x axis value in the DataTemplate.

Thank you!

Dan

TemplateValuePresenterderivative of ValuePresenter , so that you can use it anywhere a ValuePresenter is necessary, such as the LabelPresenter property on the MajorDivisions of an axis:



        

            

                

                    

                        

                    

                

            

        

    

The division value is passed as data context, so you can use {Binding} to access (this is also how the ContentTemplate on content controls in WPF). To convert between time and MHz, you can pass a custom binding converter.

Alternately, you could derive from ValuePresenter or one of its children yourself and put the logic of the conversion:

public class CustomValueFormatter : ValueFormatter {

        

        protected override string FormatCore( TData value, ValuePresenterArgs args ) {

            double valueInMHz = (double)(object)value;

            double result = ConvertToTime( valueInMHz );

            return result.ToString( "0.##" );

        }

        

        ...

    }

Tags: NI Software

Similar Questions

  • WPF chart: difficulty width of vertical axis

    How do I do that? Currently, it is automatically resized to fit label max tick.

    I just use TemplateValuePresenter as a simple XAML example only. When you set your own trainer of value, you can return any user interface element to display. For example, if you were derived from GeneralValueFormatter , you can use code like below wrap his design in a Viewbox :

    protected override UIElement VisualizeCore( TData value, ValuePresenterArgs args, UIElement existingVisual ) {

            var viewbox =

                   existingVisual as Viewbox

                ?? new Viewbox { MaxWidth = 16, StretchDirection = StretchDirection.DownOnly };

    viewbox.Child = base.VisualizeCore( value, args, viewbox.Child );

            return viewbox;

        }

    Your XAML code snippet, it seems you want to specify a .NET "0.00" format. In this case, you can use the StringFormat property provided by Binding :

Maybe you are looking for

  • MacBook Air starts after you download El Capitan.

    Help, please... I can't reboot my computer after a recent update. This has happened once before, so I don't know if it has nothing to do with the download. I get the ringtone, the Apple logo and progress bar starts, but stops at half way through and

  • Satellite L850D - slow all in game

    Hello I have a L850D Satellite and I have a problem to play a game.Its so slow work as the computers in the 1990s. What could I do to makeit right work and without problems? WINDOWS 7

  • Cannot add bookmarks with WB and/or all extensions disabled

    Using FF 3.6.8. Updated for FF2 a few months when I found extension 'Old manage bookmarks' which allows me to see all the bookmarks and folders to different levels of tree in a single window. But since the upgrade, I can't add a bookmark for a Web pa

  • generator problems

    Hello I can't understand what is happening. I create several executable files, and all of a sudden, I get a crash when starting my executable? I get the error appearing in this issue. Anyone know how to fix this? Kind regards Thijs

  • Hello.. I have a m1160 Center of HP media which crashed and does not start until now

    I tried to use the system recovery disks provided with the computer... they do not seem to work even with bios configured to boot cd-rom. Please help me