2013-04-28 196 views
0

我有一個數據模板內的圖像,我想調用一個方法時,它獲得焦點,但gotfocus事件不會觸發。下面是代碼:GotFocus事件沒有觸發

<DataTemplate> 
     <Canvas x:Name="cv"> 
       <Image x:Name="img1" Source = "{Binding ModelImage}" Stretch="Fill" Width="432" Height="357" MaxWidth="432" MaxHeight="357"/> 
       <Image Source = "{Binding HairStyleImage}" Stretch="Fill" ManipulationMode="All" ManipulationDelta="ResourceImage_ManipulationDelta" GotFocus="focussed" LostFocus="lostFocus"> 
         <Image.RenderTransform> 
          <CompositeTransform /> 
         </Image.RenderTransform> 
       </Image> 
     </Canvas> 
</DataTemplate> 

回答

2

MSDN document

影像不是真正的控制,因爲它不是一個子類 控制。您無法將焦點調用到圖像或將其放入選項卡序列中。

所以你不能叫GotFocusLostFocus事件Image控制。