private void OnLoaded(object sender, RoutedEventArgs e) { if (sender is FrameworkElement) { FrameworkElement fele = (FrameworkElement)sender; while (fele != null) { if (fele is MRACltBox) { MRACltBox cltbox = (MRACltBox)fele; cltbox.ItemPanel = this; if (cltbox.SelectedIndex >= 0) { cltbox.ScrollIntoMiddle(cltbox.SelectedIndex); } break; } if (fele.Parent is FrameworkElement) { fele = (FrameworkElement)(fele.Parent); } else if (fele.TemplatedParent is FrameworkElement) { fele = (FrameworkElement)(fele.TemplatedParent); } else { fele = null; } } } }
public MRACltItemInfo(ITextBoxCore _core, MRACltBox _parent, MRACltItemTypes _type, int _id, string _text) { this.core = _core; this.parent = _parent; this.type = _type; this.id = _id; this.text = _text; this.bolds = new List <MRACltBoldSegment>(); }
protected override void OnRender(DrawingContext ctx) { base.OnRender(ctx); if (Info == null) { return; } #region Background if (Info.IsSelected) { MRACltBox cltbox = Info.Core.View.UI_CltBox; Rect bgrect = new Rect(Point_BgStart, new Point(Math.Max(cltbox.ActualWidth, ActualWidth), ActualHeight)); ctx.DrawRectangle(background_selected, null, bgrect); } #endregion #region Icon { ImageSource icon = null; switch (Info.Type) { case MRACltItemTypes.Keyword: icon = Icon_Keyword; break; case MRACltItemTypes.Class: icon = Icon_Class; break; case MRACltItemTypes.Variable: icon = Icon_Variable; break; case MRACltItemTypes.Function: icon = Icon_Function; break; } ctx.DrawImage(icon, Rect_Icon); } #endregion #region Text { ITextBoxCore core = Info.Core; Typeface typeface = new Typeface(core.FontFamily, core.FontStyle, core.FontWeight, core.FontStretch); FormattedText fmttext = new FormattedText(Info.Text, Thread.CurrentThread.CurrentUICulture, FlowDirection.LeftToRight, typeface, 12, Foreground); foreach (MRACltBoldSegment bold in Info.Bolds) { fmttext.SetFontWeight(FontWeights.Bold, bold.Start, bold.Count); } ctx.DrawText(fmttext, Point_Text); } #endregion }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 12 "..\..\MRATextBox.xaml" ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.CommandBinding_CanExecute); #line default #line hidden #line 12 "..\..\MRATextBox.xaml" ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.CommandBinding_Executed); #line default #line hidden return; case 2: #line 13 "..\..\MRATextBox.xaml" ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.CommandBinding_CanExecute); #line default #line hidden #line 13 "..\..\MRATextBox.xaml" ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.CommandBinding_Executed); #line default #line hidden return; case 3: #line 14 "..\..\MRATextBox.xaml" ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.CommandBinding_CanExecute); #line default #line hidden #line 14 "..\..\MRATextBox.xaml" ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.CommandBinding_Executed); #line default #line hidden return; case 4: #line 15 "..\..\MRATextBox.xaml" ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.CommandBinding_CanExecute); #line default #line hidden #line 15 "..\..\MRATextBox.xaml" ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.CommandBinding_Executed); #line default #line hidden return; case 5: #line 16 "..\..\MRATextBox.xaml" ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.CommandBinding_CanExecute); #line default #line hidden #line 16 "..\..\MRATextBox.xaml" ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.CommandBinding_Executed); #line default #line hidden return; case 6: #line 17 "..\..\MRATextBox.xaml" ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.CommandBinding_CanExecute); #line default #line hidden #line 17 "..\..\MRATextBox.xaml" ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.CommandBinding_Executed); #line default #line hidden return; case 7: #line 18 "..\..\MRATextBox.xaml" ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.CommandBinding_CanExecute); #line default #line hidden #line 18 "..\..\MRATextBox.xaml" ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.CommandBinding_Executed); #line default #line hidden return; case 8: #line 19 "..\..\MRATextBox.xaml" ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.CommandBinding_CanExecute); #line default #line hidden #line 19 "..\..\MRATextBox.xaml" ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.CommandBinding_Executed); #line default #line hidden return; case 9: #line 20 "..\..\MRATextBox.xaml" ((System.Windows.Input.CommandBinding)(target)).CanExecute += new System.Windows.Input.CanExecuteRoutedEventHandler(this.CommandBinding_CanExecute); #line default #line hidden #line 20 "..\..\MRATextBox.xaml" ((System.Windows.Input.CommandBinding)(target)).Executed += new System.Windows.Input.ExecutedRoutedEventHandler(this.CommandBinding_Executed); #line default #line hidden return; case 10: this.UI_Main = ((Morenan.MRATextBox.View.MRATextControl)(target)); return; case 11: this.CV_Cover = ((System.Windows.Controls.Canvas)(target)); return; case 12: this.UI_CltBox = ((Morenan.MRATextBox.View.Completation.MRACltBox)(target)); return; } this._contentLoaded = true; }