locked
alternative to typeconverter? RRS feed

  • Question

  • Is there any alternative to typeconverter?

    I'm implementing a control which has a property "Zoom" which is a struct that accept either a fixed value or a special value. this struct works perfectly in code behind, but there is no way to set the value in xaml.

    I wish I could do the same as in WPF, SL, or WP.

    <MyControl Zoom="2"/>

    Regards,

    Alvaro. 


    Alvaro Rivoir

    Monday, November 18, 2013 4:17 PM

Answers

  • Hi, Alvaro

    There is no TypeConverter in the windows store app.

    If you're using it for Xaml attributes, the workaround is to make the type constructable.

    Refer to below sample:

    Replacing:

    <MyControl Zoom="2 look"/>

    with:

    <MyControl>
    <MyControl.Zoom>
    <Zoom Position="2" Perfo="look"/>
    </MyControl.Zoom>
    </MyControl>
    Best Wishes!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    • Edited by Anne Jing Tuesday, November 19, 2013 5:16 AM edit
    • Marked as answer by Anne Jing Tuesday, November 26, 2013 8:07 AM
    Tuesday, November 19, 2013 5:16 AM

All replies

  • with a binding you cant you use a value converter.otherwise maybe an attached property that does do the conversion?


    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Monday, November 18, 2013 9:48 PM
  • Hi, Alvaro

    There is no TypeConverter in the windows store app.

    If you're using it for Xaml attributes, the workaround is to make the type constructable.

    Refer to below sample:

    Replacing:

    <MyControl Zoom="2 look"/>

    with:

    <MyControl>
    <MyControl.Zoom>
    <Zoom Position="2" Perfo="look"/>
    </MyControl.Zoom>
    </MyControl>
    Best Wishes!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    • Edited by Anne Jing Tuesday, November 19, 2013 5:16 AM edit
    • Marked as answer by Anne Jing Tuesday, November 26, 2013 8:07 AM
    Tuesday, November 19, 2013 5:16 AM