I'm adding image items to a ComboBox, as you know ComboBox shows just one item in a row, but I want my combo to show more than one, and show images like they are all beside each other with a little space around them, so the user can pick one...
Any Help is pretty much appreciated...
You need to change the ComboBox.ItemsPanel to a WrapPanel.
You would have to edit the ItemTemplate and the ItemsPanel.
Right click the combobox and select Edit Aditional Template --> Edit Generated Items --> Create Empty
Add an image and a text to a Vertical StackPanel in the template and set the bindings.
Now leave the template editing and right click the combobox again.
This time go to Edit Aditional Template --> Edit Layout of Items --> Edit a Copy
Change the StackPanel to a UniformGrid and set the Columns property of this to 2.
The result should look a little like this:
I used sample data in this example. 2 properties: one image, one String(Name).
Related
I have a ListView form that looks like this:
How do I make it so each cell is like an editable textbox so the user can edit the values by clicking on a cell? Like if they click on "Count" a text edit cursor should appear in-place and they should be able to type to change the value of the field (Not in a separate dialog box or text field)
The ListView is intended for flexible display of a list of items. Similar to windows explorer's ability to show icons, thumbnails, details and basic list, all from the same set of objects. If you really want to edit all of the elements in your data objects, you should probably read up on DataGridView and data-binding.
The image above depicts a ListBox. You can see the rows are able to be selected. However they should be not selectable when i click on the row, but i have no idea on how to solve this problem.
My question is, how to make the listbox rows above not able to be selected?
The easiest solution would be to use an ItemsControl instead of a ListBox. It's a similar control that doesn't allow selection.
You can retemplate the control, removing the selected state animation. Easy to do if you have Blend.
Right click on the ListBox, select Edit Additional Templates | Edit Generated Item Container | Edit A Copy. Switch to the States tab and choose the Selected state. (For Silverlight) you should see that the Rectangle "fillColor2" has a red circle, showing it's Opacity property is animated in this state. Expand fillColor2, click Opacity, and press delete. You can also do the same for the Focused state (and MouseOver state, if you don't want a mouseover effect)
I'm wondering if I can make fake sections in the popup menu:
The rule would be, if the 5th character of the displayed item is different from the 5th char of the previous item in the menu, it has to be highlighted
What do you think?
Thanks!
To achieve this would be a hack.
Normally the items that appear in the popup part of a combo box will be an instantiated data template, and each gets its own data item and has no clue or knowledge of the other items in the list, so you couldn't use a converter or anything else to achieve this behavior.
What you could do though is inject (attach) your own control into the popup part of the combo box, and take over the rendering of the data items. How you do this will depend upon which combo box you are using (i.e. MS or some other vendor's) and would be a whole new question.
Would that be easier if I were to create my own combobox as follow:
a TextBox associated with a Button that when pushed would popup a datagrid in which I could implement this conditional formatting?
I am displaying a database table on a grid view and displaying a selected item's details in a detailsview.
Here's the problem:
There's a combobox in the detailsview and I want to display the added value's string on grid and I want the combobox to select this value.
It will be possible to update, delete the selected item from grid or add a new item. And I couldn't do the transformations of string- comboboxitem-database item. And I am quite confused on the binding operations. I hope my question is clear enough. Thanks in advance for any help.
One solution that may preserve your sanity. Only allow edits in your detailsView. Use the grid to Add (clicking an Add Link which shows the detailsView) or Delete. Is it really necessary for the user to be able to edit in either place?
I need to place a ComboBox in a place where I have very limited space. Is there any way to show content for the SelectedItem in the ComboBox that is different than the content that is displayed for the item in the ComboBox's Popup?
As an example, Firefox does this with it's Site Search box in the top right of the browser. When you open the dropdown, the site names are displayed along with their respective logos, but when a site is selected, only the icon is displayed.
UPDATE: Solution found :-)
I found a solution at this site:
http://blogs.windowsclient.net/airborneengineer/archive/2009/06/25/wpf-styles-and-templates-part-ii-combobox-customization.aspx
I just needed to modify the "DisplayImageWithText" DataTemplate to only show the field I want.
Yes, have 2 sets of data and change the display member column of the combobox - according to the position. as long as the value is the same, it will work good, and you'll get 2 displays out of the same combo-box.