I have textbox which accepts string for File name. The user can give/type any name for textbox, even he copy text (Multilingual text) and paste in the textbox. He can copy from any source.
The issue is, how do i detect the 'Language' of copied text which is pasted in textbox and
display the text in that corresponding language?
There is a .net library that does the job:ntextcat ... and ... it`s open source.
Also, you can use google-api-for-dotnet to the actual translate.
May be ill think of having a common words in a dictionary for each language and looking it up when user pastes it. If i find it in any of these dictionary item, then ill know its language type. May not be the best solution your looking for. Open to experts comment here.
Related
I want to be able to bind content control fields to each others' values. Basically if you change a field at the top, all others in the document also update to that. I'm replacing hundreds of individual variables, each with 100 duplicates. There is a better way than the 'Find and Replace Tool'.
Here is a sample document directly from Microsoft's site that shows exactly what I would like to be able to do:
https://omextemplates.content.office.net/support/templates/en-us/tf03444179.dotx
When the '' value is changed, all others in the document update.
I've already looked at plenty of solutions like: c# word interop find and replace everything
But they do not dynamically respond during run-time. In other words you have to go in and change which string you want to replace for each value.
Been looking for a while now, thanks in advance if anyone else can figure this out.
Basically in RichEditBox you can paste text and it can automatically format that pasted text according to what you copied. I am wondering how to set a specific part of the document, such as a word, or sentence, to a specific form of font colour, or font style, or any other properties regarding text.
I cannot find any real documentation on how to do such a thing.
EDIT:
I found:
richEditBox.Document.GetRange(3, 10).CharacterFormat.ForegroundColor = Windows.UI.Colors.Blue;
If someone knows something nicer, post please.
Simply use
richEditBox.Document.GetRange(3, 10).CharacterFormat.ForegroundColor = Windows.UI.Colors.Blue;
Are you looking for something like this?
http://msdn.microsoft.com/en-us/library/0dhsw8eb(v=vs.90).aspx
I already did some research and ended up with several autocomplete boxes which have one thing in common: they all match the whole expression which has been entered. Sometimes, they seem to be easily expandable, but at the end, they aren't.
However, I need a Textbox which allows the user to enter a word (e.g. "tag1"), displays a popup with some suggestions based on this single word, accept the suggestion with the return key and type in a new word (e.g "tag1 tag2") in the same textbox, with the popup popping up again. (I like the way CintaNotes handles this)
I need this for a tagging interface. It's often faster for the user to write the tags into a simple box, but sometimes, he needs assistance. This is what the autocomplete is for.
I've found some results, which don't work for my purpose (imho):
http://www.wpfpedia.com/item/details/743/wpf-autocomplete-textbox-control
http://www.codeproject.com/KB/WPF/WPF_Autocomplete.aspx
http://www.codeproject.com/KB/WPF/autocomplete_textbox.aspx
http://weblogs.thinktecture.com/cnagel/2011/01/autocomplete-textbox-with-wpf.html
Btw, I really like the way the Tag-Box for SO operates.
Does anyone have an idea? Is there a "out-of-the-box" - solution somewhere, which suits my needs but I didn't find? Or do I have to build one myself?
Thanks! :)
I think you mean a textbox which autocomplete for multiple words.
Like TokenizedTexbox on WPF Extended Toolkit.
this is the page: http://wpftoolkit.codeplex.com/wikipage?title=TokenizedTextBox&referringTitle=Home
Probably you would need to create your own Dictionary object of Key and Value pairs and hook that Dictionary to the textbox events and popup a suggestions dialog that displays the Value(s) from your Dictionary
Check this implementation out: http://code.google.com/p/kocontrols/downloads/list
You may inject your own Search algorithm and your own converter which converts the selected element to text, which you display in the TextBox. You will have to modify it slightly but I think that you might be able to solve your problem by basing your control on this implementation.
I never thought about this type of use case.
Can't you use different textboxes for the different tags? Something similar to how goole code does it?
If you have time, you can use the RichEditControl or TextBox and apply the same pattern used in Intellisense engine or Code Completation enabled editors: Hook the text changes events, Recogize context (last/current word) and display the options list on popup control. And optionally, on commit (detect acceptation or space key), apply the format to the word.
i was wondering if it is possible in c# to set to a text box a list of strings that are clickable links? at the moment i can set the text box like this
txtBox.Lines = values.ToArray();
ideally though i would like them as links if possible? maybe link labels or something?
(I'm assuming you're using Windows Forms; the answer for WPF/Silverlight may be slightly different.)
A textbox just contains text - it's not "rich" enough to have links.
If you want a list you might want to consider using a ListBox of some description - or possibly a RichTextBox; I haven't tried creating links in a RichTextBox, so I don't know whether it's possible.
Of course, you haven't specified what you want to happen when the user clicks on the links, either...
Use RichTextBox and check this - http://www.codeproject.com/KB/edit/RichTextBoxLinks.aspx
You can try using Windows.Forms.Controls.LinkLabel. It allows storing multiple links along with the text in it.
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!