// protected override void OnStart(AppHost host) { _textbox = new LayoutFarm.CustomWidgets.TextBox(400, 300, true); _textbox.SetLocation(20, 20); var style1 = new TextEditing.TextSpanStyle(); style1.ReqFont = new PixelFarm.Drawing.RequestFont("tahoma", 14); style1.FontColor = new PixelFarm.Drawing.Color(0, 0, 0); _textbox.DefaultSpanStyle = style1; var textSplitter = new CustomWidgets.ContentTextSplitter(); _textbox.TextSplitter = textSplitter; _sgBox = new SuggestionWindowMx(300, 200); _sgBox.UserConfirmSelectedItem += new EventHandler(sgBox_UserConfirmSelectedItem); _sgBox.ListItemKeyboardEvent += new EventHandler <UIKeyEventArgs>(sgBox_ListItemKeyboardEvent); _sgBox.Hide(); //------------------------------------ //create special text surface listener var textSurfaceListener = new LayoutFarm.TextEditing.TextSurfaceEventListener(); textSurfaceListener.CharacterAdded += (s, e) => UpdateSuggestionList(); textSurfaceListener.CharacterRemoved += (s, e) => UpdateSuggestionList(); textSurfaceListener.PreviewArrowKeyDown += new EventHandler <TextEditing.TextDomEventArgs>(textSurfaceListener_PreviewArrowKeyDown); textSurfaceListener.PreviewEnterKeyDown += new EventHandler <TextEditing.TextDomEventArgs>(textSurfaceListener_PreviewEnterKeyDown); _textbox.TextEventListener = textSurfaceListener; //------------------------------------ host.AddChild(_textbox); host.AddChild(_sgBox.GetPrimaryUI()); //------------------------------------ BuildSampleCountryList(); }
// protected override void OnStart(AppHost host) { _textbox = new LayoutFarm.CustomWidgets.TextBox(400, 30, false); _textbox.SetLocation(20, 20); var style2 = new TextEditing.TextSpanStyle(); style2.ReqFont = new PixelFarm.Drawing.RequestFont("tahoma", 14); style2.FontColor = new PixelFarm.Drawing.Color(0, 0, 0); _textbox.DefaultSpanStyle = style2; var textSplitter = new LayoutFarm.CustomWidgets.ContentTextSplitter(); _textbox.TextSplitter = textSplitter; _listbox = new CustomWidgets.ListBox(300, 200); _listbox.SetLocation(0, 40); _listbox.Visible = false; //------------------------------------ //create special text surface listener var textSurfaceListener = new LayoutFarm.TextEditing.TextSurfaceEventListener(); textSurfaceListener.CharacterAdded += (s, e) => UpdateSuggestionList(); textSurfaceListener.CharacterRemoved += (s, e) => UpdateSuggestionList(); textSurfaceListener.PreviewArrowKeyDown += new EventHandler <TextEditing.TextDomEventArgs>(textSurfaceListener_PreviewArrowKeyDown); textSurfaceListener.PreviewEnterKeyDown += new EventHandler <TextEditing.TextDomEventArgs>(textSurfaceListener_PreviewEnterKeyDown); _textbox.TextEventListener = textSurfaceListener; //------------------------------------ host.AddChild(_textbox); host.AddChild(_listbox); //------------------------------------ BuildSampleCountryList(); }