none
按下一个image 后缩小一点,松开后恢复 .就像他在gridview中一样.但是他不在那里面. RRS feed

  • 问题

  • 按下一个image 后缩小一点,松开后恢复 .就像他在gridview中一样.但是他不在那里面.

    在griview中的item 按下时会缩小一点 普通控件 怎么实现?

    2013年12月23日 6:18

答案

  • Hi,

    请不要在英文论坛发中文贴,我将您的帖子移到中文论坛!

    我并没有在Gridview中看到您所说的现象。如果您想在某个控件按下时它会缩小,放开时他会恢复到原来的大小,那您可以在该控件的PointerPressed和PointerReleased里面改变该控件的ScaleTransform。您可以参考一下下面的代码:

     
    <Image Source="Assets/Logo.png" Width="300" Height="300"  PointerReleased="Image_PointerReleased" PointerPressed="Image_PointerPressed" >
                <Image.RenderTransform>
                    <ScaleTransform x:Name="myScaleTransform" />
                </Image.RenderTransform>
            </Image>
     private void Image_PointerReleased(object sender, PointerRoutedEventArgs e)
            {
                myScaleTransform.ScaleX = myScaleTransform.ScaleX * 1.25;
                myScaleTransform.ScaleY = myScaleTransform.ScaleY * 1.25;
            }
    
            private void Image_PointerPressed(object sender, PointerRoutedEventArgs e)
            {
                myScaleTransform.ScaleX = myScaleTransform.ScaleX * 0.8;
                myScaleTransform.ScaleY = myScaleTransform.ScaleY * 0.8;
            }
    祝您好运!



    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.

    2013年12月24日 2:29
    版主

全部回复

  • Can you please post this in English, or on a forum that uses your language?

    这个中文论坛的都可以


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    2013年12月23日 15:48
  • Hi,

    请不要在英文论坛发中文贴,我将您的帖子移到中文论坛!

    我并没有在Gridview中看到您所说的现象。如果您想在某个控件按下时它会缩小,放开时他会恢复到原来的大小,那您可以在该控件的PointerPressed和PointerReleased里面改变该控件的ScaleTransform。您可以参考一下下面的代码:

     
    <Image Source="Assets/Logo.png" Width="300" Height="300"  PointerReleased="Image_PointerReleased" PointerPressed="Image_PointerPressed" >
                <Image.RenderTransform>
                    <ScaleTransform x:Name="myScaleTransform" />
                </Image.RenderTransform>
            </Image>
     private void Image_PointerReleased(object sender, PointerRoutedEventArgs e)
            {
                myScaleTransform.ScaleX = myScaleTransform.ScaleX * 1.25;
                myScaleTransform.ScaleY = myScaleTransform.ScaleY * 1.25;
            }
    
            private void Image_PointerPressed(object sender, PointerRoutedEventArgs e)
            {
                myScaleTransform.ScaleX = myScaleTransform.ScaleX * 0.8;
                myScaleTransform.ScaleY = myScaleTransform.ScaleY * 0.8;
            }
    祝您好运!



    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.

    2013年12月24日 2:29
    版主