I'm looking for a Textbox control that works similar to the email recipient textboxes in Outlook (the To, Cc and Bcc inputs). It shall have below characteristics.
Allow user text inputs with auto complete based on history
Word/Phrase identification, separation, underlining (like links)
Keep a list of objects represented by these words/phrases
Once click on a work/phrase fire an event to show the corresponding object related to that entry.
If nothing is out there, I may look to develop one by my own. Any help to direct me either on existing controls or how to do it, is highly appreciated.
Tks,
- Eranga
I don't know of products out there but i'd approach this problem by having a look at the code in the richtextbox WPF Extended toolkit (you can nuget it but i'd download the code)
In there is a formatter which will allow you to markup flowdocuments in the rtb. if each address is stored as a run in the rtb you have your list of separate items which you can process as you like. there also a bunch of events you can hook into as well.
All this assumes you are using WPF.
Related
I am trying to modify a custom content control I've created. Specifically I want to add a minibar containing one or two buttons to a quick and short modification of the text included in my content control. The image below shows the outcome I want to have - the problem is that these buttons are only shown in built-in table content control and I can't find any useful information on the web about how to create something like that myself... Could you help me?
Unfortunately, the commands shown next to the content control title are not customizable; it's definitely something we've thought about, but this isn't possible today.
You could use the ContentControlOnEnter and ContentControlOnExit events to show buttons on the context menu or the ribbon; depending on your scenario, that might work?
Is there any library available for Windows Phone with the tags in a search box feature? So if I start typing age, the search box should predict agent and agent smith etc and on tapping the predicted results, the search box gets filled with the tags (example image attached). Handling events like, backkeypress highlights the tag and another backkeypress removes the tag etc. Predicting results is easy, what I am looking for is all the events handling for search box with tags. Any free/paid library for the same?
There are a few AutoCompleteBoxes (Telerik, Windows Phone Toolkit), but the just work for one item. If you want more items, you need to create the control by yourself.
A lot of third party controls are available but you should prefer to write your own control. I used http://wpfactb.codeplex.com/releases/view/42340 control but you have to customized it and bugs are there to be fixed .
So I will suggest you to get hint from this and write your own control.
For something as specialized as this, I would write it myself. And XAML suits really well for such tasks.
One horizontal stackpanel with custom styled buttons being added, and one LongListSelector for the results.
This is very simple to implement.
Set the InputScope in your textbox.
On typing , you will get the possible result.
When you tap on the respective suggestion, you will get the value.
Create a Grid or Stackpanel and create a ellipse which should hold the tag value.
On tap of the value, add the value inside the created ellipse.
I have a single line textbox, when I copy some text from lets say notepad that is on multiple lines and paste them in to my text box, only the first line of text appears (thats obvious) but how can I change this so that the lines are joined automatically upon pasting them and separated by a space. I see that I would need to modify the textbox_changed event but this would affect everything that goes on in that textbox not only the paste event. Could you provide me with some code to handle a paste event and ignore all other events.. thanks :)
winforms
mouse paste event
is this what you're looking for?
Clipboard Events
A Textbox in C# has a number of useful events to indicate when certain actions have been taken. For example, .NET textboxes have an event to indicate when the text has changed or when the user has pressed a key. These events allow C# developers to write clean code that interacts with textboxes.
Following the same principles, we can manually implement events that are triggered by clipboard actions, i.e. text is cut, copied, or pasted in the textbox. The .NET Framework does not come with these events, but they are not difficult to implement.
7/5/11 Update: Added support to suppress copy, cut, and paste events.
Custom Textbox
To implement custom events, we are going to have to create our own textbox user control. The user control will inherit the Textbox class since we want all the default behaviors of a .NET textbox.
Creating a custom user control will also let us override the WndProc function, which processes messages passed to the control. By overriding the function, we can detect messages such as when text is cut, copied, or pasted, before allowing the control to process them.
if you are using .asp webforms you need to change the text mode in your textbox
to SOMETHING LIKE THIS TextMode="MultiLine" Columns="50" Rows="5"
in Winforms
textBox1.Multiline = true;
I am trying to break out of vb into c# and needed a personal project to get some c# practice in to cement the syntax differences in my mind.
I decided (for want of something better) to write a little twitter client, only something basic.
I have designed a user control to contain the info about each tweet (the tweet itself, the user that tweeted, the date and time etc). As we know tweets can contain embedded links in their text and I was wondering how you handle this in a windows form.
There seems to be a Linklabel control, but you don't seem to be able to have normal text in it, the Label control similarly doesn't support clickable links.
Would I have to embed a link label inside a normal label control and parse the tweet text for url's?
Or am I approaching this in completely the wrong way? :)
You can (sort of) combine normal and linked text in a LinkLabel:
this.linkLabel1.Text = "Here is some text";
this.linkLabel1.LinkArea = new LinkArea(0, 4);
Problem is, there can only (AFAIK) be one link destination, which is obviously not going to work for your purposes.
One possibility may be to use the RichTextBox, and handle the LinkClicked event. I'm not sure if that will give you enough information, but if nothing else, will provide some good practice, since that's the goal anyhow!
Currently, I'm in the process of making a custom solution for invoicing. I have created multiple ways for customers to create their template (HTML, Word, LaTex) and get invoices according to their template. However, these invoices are party manually generated.
So, the process is:
Request to create a new invoice
An preliminary invoice is created
The user gets a chance to make changes (i.e. add, remove, change rows)
Create a pdf
Just to be clear, the preliminary invoice does not need to be formatted as the template is, but you should be able to add/remove/change rows and for every cell, indicate whether the value should be visible in the final result.
My problem is that i cannot find a suitable way to display the preliminary invoices. I tried a datagrid (default, telerik, devexpress), but it's too messy. Besides a datagrid, i have no idea what i can use.
What controls can i use best to have a nice and usable UI.
Please don't be like this:
alt text http://bitsandpieces.us/wp-content/uploads/2008/03/imagesapple-20google-20and-20you.png
A typical UI paradigm for this kind of thing is to view it as two separate problems: giving the user a way of viewing the elements that he can modify, and giving him the ability to modify any specific element. You use a list control (ListBox, ListView, maybe TreeView if the elements are organized hierarchically or need to be grouped into categories) to present the elements, and then when the user selects an element the program presents a tabular presentation of field names and editable value controls.
Basically, you're dividing the program's functionality into two categories: stuff that the user wants to do to rows (add, remove, re-order, select) and stuff that the user wants to do to the selected row's elements.
You can mush these two sets of functionality into one if you use a DataGridView, but as you've seen that gets pretty ugly if there's any complexity to the elements you're editing.
Two possible approaches to this: the property-sheet paradigm (select object, right-click, select "Properties", edit values in a modal dialog), or a paradigm where the window's split into two panels, with one being the rows and the other being the details of the currently selected row. There are lots of others.
What is your platform? Winforms? WPF?
What exactly did you dislike about using a datagrid for this? Part of the problem is that whether you like it or not, you're going to be coding a datagrid - you essentially described features of one. If at all possible try to use someone else's datagrid because it will save you a lot of work. Typically, 3rd party datagrids should be fairly customizable, and you should be able to make it look however you want - and take advantage of the built in sorting, editing, grouping, etc. Creating a datagrid-like control from scratch isn't easy and should be avoided if possible.
You don't have to have a plain giant datagrid - you can crate a custom control that displays the invoice formatted however you like, with a live datagrid appearing only where the invoice shows tabular data, formatted to appear as an integral part of the invoice itself.
I'm doing something similar, where the client can edit or even remove the line items for the invoice prior to sending it to the client.
The current app they run their business on is a WebForms Intranet application, so this is an extension to that. So they can add/remove/edit rows fairly easily.
But Egor is right. You're essentially talking about a datagrid no matter what you do. I take it you want something 'cleaner' and more intuitive?
Simplicity is difficult.
I would take a look at what is already out there, especially for invoices, and see how they are doing it.
Not sure how big your company is, but it never hurts to take advantage of the large company applications and user interfaces, the pour thousands/millions of dollars into user interface design and testing.
I would take a look at any of the following (most offer a free trial, or just try searching for screenshots):
www.freshbooks.com
www.invoicera.com
www.getcashboard.com
www.simplifythis.com
Just some ideas ... hope this helps!