Facebook
From Colorant Agouti, 9 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 437
  1. private void TranslateRootVisualY(int yNew)
  2. {      
  3.   var rootFrame = Application.Current.RootVisual as PhoneApplicationFrame;
  4.   rootFrame.RenderTransform = new CompositeTransform() {TranslateY = yNew};
  5. }
  6. In your case, you can eliminate the automatic translation and make ScrollViewer scroll to desired offset in GotFocus event:
  7.  
  8. private void firstNameTxt_GotFocus_1(object sender, RoutedEventArgs e)
  9. {
  10.    TranslateRootVisualY(0);
  11.    Dispatcher.BeginInvoke(() =>{
  12.       double destOffset;
  13.       //...calculate destination offset
  14.       ContentPanel.ScrollToVerticalOffset(destOffset);
  15.    });
  16. }