/// <summary> /// Set offset for this page /// </summary> public void Scroll() { foreach (var item in from object item in PianoKeys.ItemsSource let key = item as KeyContext where key.Value == PianoRollContext.TopKey select item) { PianoKeys.ScrollTo(item); } }
/// <summary> /// Initialize offset for this page /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void PianoKeys_OnLoaded(object sender, RoutedEventArgs e) { _pianoRollContext = this.DataContext as PianoRollContext; foreach (var item in from object item in PianoKeys.ItemsSource let key = item as KeyContext where key.Value == PianoRollContext.TopKey select item) { PianoKeys.ScrollTo(item); _cellWidth = (_items[item].ActualWidth * 4) / (5 * 16); } }