I am working in a wpf project in which I need to compare two strings and display in a side by side window with line number should be shown and differences must be highlighted with color.
I am new to wpf and I don't have any idea about completing this task.
Please help me.
Are you looking at something like Syntax Highlighting of Text after comparison(or identifying the differences)? Below links might help you if you want to do simple highlighting of the text. The idea should be simple perhaps:
Identify the Difference
Find the start and end position of difference
Highlight the difference only.
If you'd want to go for simple solution, check these link if they work for u:
https://code.msdn.microsoft.com/windowsdesktop/CSWPFSearchAndHighlightText-3b5e207a
https://social.msdn.microsoft.com/Forums/vstudio/en-US/7c9a622a-4e3b-451e-bc4c-ab9d011447e0/texthighlighting-in-wpf-richtextbox?forum=wpf
Moreover, there are several controls available online for Syntax Highlighting in wpf. You can simply search for it. I came across Fast Colored TextBox on CodeProject once for similar requirement. Hope this helps.
I think this would be the generic advise I might be able to offer for a generic question like this. Or u may want to go a bit more specific about what type of content you are trying to highlight? Is it Rich text or plain text in a TextBlock? And as the comment above? Any research & considerations you've done? And any code to give an idea about the scenario?
Related
I'm trying to build a confirmation window that lists to the user all the changes he has made on a given object.
I have already built eh backend that is simply a Dictionary<string, IConfirmation> that lists confirmations that should be made.
However I don't know how to generate a template for each of them that would look like the mockup below, and load them all in a confirmation window after that.
I've already looked at the Data Templating from msdn but it seems to only template static data (i.e. no input possible neither embeded control).
Any idea? Thanks in advance for your help!
Don't expect for code since you didn't provide any code to start with :). But DataTemplate seems to be the right option for this, in my opinion. The above MSDN link you posted shows exactly how to use DataTemplate in detailed, step by step manner. You can just follow what explained there, and change TextBlocks to TextBoxes or any other input control you want to use. Using input controls shouldn't be an issue for DataTemplate as long as you use DataBinding in two way mode.
I was just curious if it's possible to put a "separator" (Not sure what you'd call it) in a textbox in ASP.net. For example, I want a textbox on my form to be a blank textbox with "blank:blank:blank" so they can just type the time, and another to be "blank/blank/blank" for the date, and so on. I've tried googling it for a bit but didn't find what I was looking for, probably because I'm calling it a seperator, and I'm not sure how accurate that is. I was hoping it could be done that way, but if there's another way, I'm using C#. Let me know if I explained that right at all or if you can recommend anything. As before, I appreciate the help from this community!
Probably should start with checking out if an input mask meets your needs. The AJAX Control Toolkit might be a good place to start when looking at easy to use controls. Check out their MaskedEdit control at: http://www.asp.net/ajaxlibrary/AjaxControlToolkitSampleSite/
Use the MaskedEdit control in ASP.NET (from the AJAX Control Toolkit), should do exactly what you want.
HOW TO Use the MaskedEdit Control in ASP.NET
I've been out of doing proper programming for sometime, so as an exercise in trying to get some practice, I'm trying to make a program to solve Sudoku in C# (VS 2010)
My problem occurs when I'm trying to create some form of initial grid for the data out of text boxes. Back when I used to use VB6, I could call all text boxes as a single name and then give them all an index number which would allow me to refer to a specific text box when I was in a loop.
As far as I can see, there's no easily visible equivalent in C# and my searching has been to no avail although I can't imagine it'd be a feature that would be removed.
Thanks in advance
You can create a control array.
http://www.devasp.net/net/articles/display/674.html
It would probably be easier, and look better, if you use a genuine grid control like the DataGridView.
One bit of bad news. In the days of VB4,5,6 Microsoft used to release a new grid control with every version of Visual Basic, which was annoying (unless you rewrote your code every year). Well, they are still at it.
I'm developing a xmpp chat client in C#.NET. I'm little confused about what control should I use for Buddy list. Buddy list will consist of status icon, name & his buddy pic. Can u please recommend that what control will be best for me to use? (Do u think that ListView will be appropriate?)
Another question, I'm using agsxmpp. Does it support invisible status in Gtalk. Is there any library out there bettre than this ?
Thanks.
I think the ListView would be fine, it supports everything you would need. You could also go with an owner-draw ListBox if you want something with a little more flexibility (though obviously, that'd be more work).
As for your other question, I'm not sure. You might want to check the documentation for the library.
Using TreeView will be the best control, it will help you in grouping buddies. I used it before for the same purpose.
The RosterTree code in Jabber-Net would be a good starting point. It already does owner-draw, and could be pretty easily extended to do avatars by modifying the DrawItem method.
I am wondering if anyone has any experience in creating a new control based on a WPF text box that could support syntax highlighting, line numbers, etc.
Any links or advice on how i could begin creating something like this would be very helpful.
Hey there. I don't have any personal experience implementing something like you're suggesting, but I found a couple of links that might help you out.
Derived rich text box with syntax highlighting
SharpDevelop (it's open source and you can probably grab some insights from their source code for syntax highlighting)
Syntax highlighting in a Coacoa app (maybe glean some approaches from this)
This should help you to start WPF Syntax Highlighting in RichTextBox