What WPF control should i use for my window? - c#

So im making a WPF project where one of my windows has to let the user see a text. Select parts of this text for being put into an array of strings and no more than that. So he/she musnt be able to edit anything in the text only highlight parts and then click on a button. What WPF control would be smart to use for this?

I'd probably just use TextBox with IsReadOnly set. The various selection properties are all you need after that.

Related

how to modify the text property for all object in the form at run windows form c#

I have a form like Invoice and more forms in my application and have a lot of controls in form like text box , label , datagrid , tree view and other
I want make a Method to read the object by object from this form to change text property or caption property - its will be useful to let the user change the control caption by himself when the program complete -
Note : some controls include object like Navbar control or datagrid control have a columns or a nodes and I want to change Column and node Caption by code
best Regards
For example,
Label.Text = "My text";
for datagrid you will need to access the cell of which text you wish to change.
I'd recommend you to go through all the methods and properties of all controls that appears in intellisense. It will guide and teach you alot.
such as write the control name and write Dot after it.
DataGrid.
an Intellisense will appear with methods with their summary. Read them to find out what they do and use them.
DataGrid.Rows[array as it is Enumerable].Cells[array as it is Enumerable].Value <- This is a hint for you to find out yourself. It will be slow but it will make you independent. Good luck :)
You can achieve to change the text for the treenode at any level with the guide i provided above. Just go through the Intellisense and you'll start to understand what you need to do.

Configure the selected control's Text of the user Control

I am creating a group of panels with labels in it. Depending on the requirement of the User. Kind of mimicking the Tab control here. Where like the Tab control's Title is editable, i would let the user to configure the name of the labels at design time. How possibly can i achieve it?
In the event Handler of the Label, change the label to a TextBox. When the TextBox looses focus, replace it with a Label again
Please chehk the following thread (Header Editable Tab Control in WPF).
If you use WPF, then this is exactly what you need for your work. If you use another template, maybe still can add some tips. :)
Good luck

Windows Phone Search box Tags on tapping search results

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.

How to make something similar to Visual C# 2008 properties window?

What interests me is everything below the bar with buttons that determine how the properties are displayed. All I can figure out is there is a splitter and a status strip.
What I'm after is how there are 2 sections which I want to add the titles Property and Value, the sections can be resized with a splitter (I assume a splitter is used in this case), each property can be selected and the corresponding description appears on the status strip, and each value can either be text or a dropdown box.
The coding part I can probably do by myself, what I need to know is what controls the window is made up of and how it's put together.
You are referring to the PropertyGrid control. It's in the ToolBox.
See Getting the Most Out of the .NET Framework PropertyGrid Control
This is the PropertyGrid, and can be used directly. There is no need to reinvent the wheel here...

How do I change the appearance of some text in a textBox?

I'm building a program similar to Messenger, sort of a chatting software.
I created a textBox to display the conversation log, and I want to make it look like this:
Nick1: Hi.
Nick2: Hello.
How do I make part of the text bold?
I also want to allow users to change their own font, font-color and so on...
Thanks in advance.
Use RichTextBox if building a Windows Forms or a WPF app.
The best way is to use a RichTextEdit control, this control can take RTF format codes to easily format the text the way you want it.
eg.
\pard\plain\ltrpar\f0\fs14\sl240\slmult1\b\ Nick1.\par
\pard\plain\ltrpar\f0\fs14\sl240\slmult1\Hi
will show up as Nick1 Hi
Assuming you're using WPF I'd use an ItemsControl to display the conversion. Then for each item I'd have a couple of TextBlocks one for the user name (which would be bold) and the other for the message.
Hope that helps.

Categories

Resources