locked
[UWP]Change Border Thickness on Mouse Over UWP RRS feed

  • Question

  • I am designing menu and I have list of items in VariableSizedWrapGrid.

    I want to change border thickness of Current active element on MouseOver also I want to change foreground color of title of child TextBlock. How should I achieve this in UWP using MVVM?

    Way I know is:

    1. Use Interaction and call ViewModel command on MoseOver.

    2. Command will set BorderWidth property of VIewModel

    3. BorderWidth property would bind to BorderThickness property of control

      BorderThickness="{Binding BorderWidth}"

    This will work great with one VariableSizedWrapGrid's item. But I have 3 items. Do I need to create 3 commands with 3 ViewModel Properties which will bind border thickness to respective item?




    • Edited by Mangesh_K Tuesday, August 2, 2016 1:06 PM
    • Edited by Barry Wang Wednesday, August 3, 2016 2:30 AM title tag
    Tuesday, August 2, 2016 1:05 PM

Answers

  • Hello Mangesh_K,

    You have the same question asked on SO here:

    http://stackoverflow.com/questions/38716877/change-border-thickness-on-mouse-over-uwp

    And the answer from Bart is also what I want to say. A good way in my mind is to "edit the default GridViewItem style and use the VisualStateManager to handle the PointerOver event" so that you can get to use the animation.

    Best regards,

    Barry


    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.

    • Proposed as answer by Barry Wang Thursday, August 11, 2016 5:49 AM
    • Marked as answer by Barry Wang Friday, August 12, 2016 2:07 AM
    Wednesday, August 3, 2016 2:44 AM