I added a listbox control to log entries but I want the entries to have a date in the right side. Apparently, I'm able to only align it one side and not able to have this text on both the side. I was wondering if it is possible. Here's a photoshopped image to describe what I need. The right side date doesn't actually turn up. I added that through photoshop but its exactly what I need.
I would like to suggest you to use ListView instead of Listbox. You can show your list with multiple columns in detail view. You can also align column value, Hide header using HeaderStyle property.
If you don't want to use ListView control and want to use ListBox. then you have three options to do that.
You can draw item using OwnerDraw method.
You can add label to the ListBox. but, it creates lot of problems when you are trying to scroll items.
Set the listbox font Courier New and use String.PadRight or String.PadLeft to place space between two item. But, in this method the item will be return with space. Here you need to process to separate that field.
Related
I came across a tutorial and some example code for an audio converter. You select the format you want to convert to from a drop down, and when you do all sorts of options appear in a previously blank area, different options based on the format you choose. It's called Audio Converter .NET and is from same author as Audio CD Ripper .NET. I can't find the tutorial, but here is a screenshot.
See how on the right there is extra controls that are not on the left. I was experimenting trying to add another category. I added it to the dropdown, but am unsure how to make it so certain fields come up when it is selected.
I understand that they create those controls for those items, but I don't see how they call the correct one when the combo box selects something. I see controls are created, but if I try to duplicate the controls into another entry in the combo box they don't show up for either the new or old one I was duplicating from.
What's the best way to go about achieving something like this?
Thanks
The easiest way is to create the controls needed for every option in the dropdown inside a panel, and simply turn it's visibility property from false to true whenever it's corresponding option is selected using the combobox's SelectedIndexChanged event handler. (And don't forget to turn the current visible panel's visibility to false)
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 am trying to get a conversation-like style going with either a ListBox or Listview but so far unsuccessfully. I don't even know where to start in order to achieve this.
I know how to style ListBox and ListView in other ways, but this particular style I have no idea where to start.
Can anyone please help point me in the right direction? Below is the kind of style I am trying to achieve:
Notice how in the image above, list items are left-aligned, but every other list item is right aligned (but the text inside the item is left-aligned), and every second list item also has a different background color.
I would consider using a DataTemplateSelector. Create a different template for each of the styles. The template selector could select one style if it's user A and another for user B or something along those lines.
I am creating a control that displays a hex value (For example FFAA-CA10-56D7) . Right now the value consists of images. The value of the control looks like:
For a read only control I have no problems. I am able to place the appropriate images according to the value. So if I have to set the value to FF for example I will iterate through the characters on the string and then place the corresponding image.
Now the problem is with read-write controls. It will be nice if I could use the same font. Right now I append images as the user types values. But it is not friendly. What if the user wants to select 3 characters by dragging the mouse?. Or how could I perform the shift+arrow key combination that will select multiple characters.
So in short I will like to keep the same look and feel of the control and I do not want to replace the images for a textbox. What approach do you guys recommend so that I can keep the same look and feel.
Things I have tried:
I tried to create my custom font from those png's. But haven't been successful on finding the right program that will enable me to create a font from png images.
I would do this by using a custom ListBox with a Horizontal StackPanel as its ItemPanelTemplate, and its ItemsSource would be a list of char. then you could provide an appropiate DataTemplate containing the corresponding images (dependending on char value, maybe using DataTriggers). ListBox has Multiselection, so you should have no problem in imitating the Text Selection behavior of a TextBox, and by having a List of char as the ItemsSouce you can also allow Copying (by doing your own implementation of EditCommands.Copy in your ListBox.
Edit: This is one of those cases in which you will definitely want to implement your own Custom Control
I'm trying to create a DataGridView cell class which hosts a control (all the time, not just while editing). So far, my approach has been to add the control to the grid and try to synchronise its position with that of the cell.
Would it be possible instead to keep the cell offscreen, route mouse and keyboard events to it, and paint it onto the cell?
UPDATE: By 'offscreen', I don't mean that it should be added to another control such that it isn't displayed; I mean that it should never be added to another control at all.
You can create a control without adding it to the form, then using it as the Cell editor whenever you need to. Usually with grids, when you click on a cell to edit it, it's going to either create a new control and put it in the right place, or it's going to use an existing control. You can make this process a lot easier by creating your own custom cell / column types. See this MSDN page: http://msdn.microsoft.com/en-us/library/7fb61s43.aspx.
Most grids (including DataGridView and 3rd Party Grids) have a facility for adding custom cells.