Beispiel #1
0
 protected virtual void OnIsCltOpeningChanged(DependencyPropertyChangedEventArgs e)
 {
     if (IsCltOpening)
     {
         int line   = Core.SelectedStart.Line;
         int column = Core.SelectedStart.Column;
         IMRATextItemInfo lineitem = UI_Main.GetItem(line);
         MRATextItemView  lineview = lineitem?.View;
         if (lineview == null)
         {
             return;
         }
         #region Canvas Top
         {
             Point p = lineview.TranslatePoint(new Point(0, 0), CV_Cover);
             if (p.Y + lineview.ActualHeight + UI_CltBox.ActualHeight < ActualHeight)
             {
                 Canvas.SetTop(UI_CltBox, p.Y + lineview.ActualHeight);
             }
             else
             {
                 Canvas.SetTop(UI_CltBox, p.Y - UI_CltBox.ActualHeight);
             }
         }
         #endregion
         #region Canvas Left
         {
             Rect   rect = lineview.GetColumnActualRect(column);
             double x    = rect.X;
             if (UI_Main.UI_Stack != null)
             {
                 x -= UI_Main.UI_Stack.HorizontalOffset;
             }
             x = Math.Max(x, 0.0);
             x = Math.Min(x, ActualWidth - UI_CltBox.ActualWidth);
             Canvas.SetLeft(UI_CltBox, x);
         }
         #endregion
         IEnumerable <IMRACltItem> cltsrcs = Counselor.GetCltItems(Core.GetInputContext());
         UI_CltBox.SetCltSources(cltsrcs);
         ITextPosition pos = Core.SelectedStart.NextSeek();
         UI_CltBox.SetInputText(String.Empty);
         UI_CltBox.SetInputText(pos.Item.ToString());
         UI_CltBox.Visibility = Visibility.Visible;
     }
     else
     {
         UI_CltBox.Visibility = Visibility.Hidden;
     }
 }