locked
WPC Controls Margin when Hosted as Winform RRS feed

  • Question

  • I have made a WPF User Control hosted in a WINFORM. I need to have the image translate or move given certain conditions.

    This would be the margin property in WPF, but when rehosted as WINFORM somekind of mapping takes place, for example, Content seem to become Text

    I need to shove my image inside the WPF user control -  what WINFORM like property is it ?

    ..

    <Image Name ="IconIndicator" HorizontalAlignment="Left" VerticalAlignment="bottom" Height="15" Width="15" Source="ARW03UP.ICO" ImageFailed="IconIndicator_ImageFailed" Margin="29,0,0,0" />

    ...

    userControl11.State.Text = "Active";  // TEXTBLOCK

    userControl11.IconIndicator.??????

    Thanks !


    andrew
    • Moved by Harry Zhu Friday, July 23, 2010 3:13 AM (From:Visual C# General)
    Thursday, July 22, 2010 5:58 AM

Answers

  • Hi Andrew,

    As long as you add a reference to presentationframework.dll assembly in the WinForm application, you can use System.Windows.Thickness class in the WinForm application as you do in a WPF application. For example:

    userControl11.IconIndicator.Margin = System.Windows.Thickness(20);

    Hope this helps.
    If you have any question, please feel free to let me know.

    Sincerely,
    Linda Liu

    MSDN Subscriber Support in Forum 
    If you have any feedback on our support, please contact msdnmg@microsoft.com
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by Linda Liu Wednesday, July 28, 2010 3:06 AM
    Friday, July 23, 2010 7:40 AM

All replies

  • Thursday, July 22, 2010 6:52 AM
  • Hi Andrew,

    As long as you add a reference to presentationframework.dll assembly in the WinForm application, you can use System.Windows.Thickness class in the WinForm application as you do in a WPF application. For example:

    userControl11.IconIndicator.Margin = System.Windows.Thickness(20);

    Hope this helps.
    If you have any question, please feel free to let me know.

    Sincerely,
    Linda Liu

    MSDN Subscriber Support in Forum 
    If you have any feedback on our support, please contact msdnmg@microsoft.com
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by Linda Liu Wednesday, July 28, 2010 3:06 AM
    Friday, July 23, 2010 7:40 AM
  • Hi Andrew,

    How about the problem now?

    If you have any question, please feel free to let me know.

    Sincerely,
    Linda Liu


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Tuesday, July 27, 2010 2:40 AM