private void SetSearchFocus() { TextBlock textBlock = _prevMatchedTextBlock[_currentSearchIndex]; HighlightKeyword(textBlock, _prevSearchKeyword, true); textBlock.BringIntoView(); }
private void AddText() { string text = taskdata.GetCurrentText(); if (text != null) { TextBlock textblock = Helpers.GetFormattedText(text); textblock.HorizontalAlignment = HorizontalAlignment.Left; textblock.MaxWidth = 700; area.Children.Add(textblock); textblock.BringIntoView(); } else { if (image != null) { Image img = new Image() { Source = image, HorizontalAlignment = HorizontalAlignment.Center }; area.Children.Add(img); img.BringIntoView(); } if (ImageText != null) { TextBlock textblock = Helpers.GetFormattedText(ImageText, 25); textblock.FontWeight = FontWeights.Bold; textblock.HorizontalAlignment = HorizontalAlignment.Center; area.Children.Add(textblock); textblock.BringIntoView(); } MessageBox.Show("Задача решена", "Сообщение", MessageBoxButton.OK, MessageBoxImage.Asterisk); } }
private void OnBringFrontSideIntoView(object sender, RoutedEventArgs e) { // The front side TextBlock is in a DataTemplate, so we must use FindName() to locate it. ContentPresenter frontContentPresenter = this.cntCtrl3D.Template.FindName("PART_FrontContentPresenter", this.cntCtrl3D) as ContentPresenter; TextBlock frontSideTextBlock = frontContentPresenter.ContentTemplate.FindName("frontSideTextBlock", frontContentPresenter) as TextBlock; frontSideTextBlock.BringIntoView(); }
/// <summary> /// Gør at vi kan se forskel på den vi har valgt /// </summary> private void SetHighlight(int index) { var visibleChilds = childContainer.Children.Cast <TextBlock>().Where(x => x.IsVisible).ToArray(); if (LastSelected != null) { //LastSelected.Style = (Style)FindResource("AutocompleteTextBlock"); LastSelected = null; LastIndex = -1; } //Må ike komme ud af scope if (index >= 0 && index < visibleChilds.Length) { //visibleChilds[index].Style = (Style)FindResource("AutocompleteTextBlockSelected"); LastSelected = visibleChilds[index]; LastSelected.BringIntoView(); LastIndex = index; } }