Add a item in a combobox but not saved - combobox

Hello I added a item in a combobox in VB.net with this command:
SelectieRcpt.Items.add("TestRecipe")
This item (Testrecipe)is then added in the combobox but when i leave the form en go back then this item is disappeared.
My question is how to 'save' this combobox item in the list
Thanks in advance,
Erik
Add a item in the combobox with .net

Related

wpf custom combobox with datagrid but after popup dorpdown the first item is not selected

i have customed a wpf combobox with a datagrid in it.
After you click the toggle button of the combobox, it will open the dropdown popup and show the datagrid like the image below.
cilck the toggle buttom to show the whole result
Now my question is why the first item in the datagrid in the dropdown popup is not selected?And if after i press the down arrow key, it will select the second(like the image below press the down arrow key right after the dropdown shows) item which makes me fell that the first item is somehow selected but the highlight background is not shown.
Is this about the focus or anything else? Really no idea here , Thanks in advance.

How to add a specific item as the last item of listview

I have a ListView control which is bound to a ObservableCollection, I want to add a specific button at the end of the last item, so that when user click the button, clear up the colltions, then hide the button. Also, if the collection is empty, don't like the button display. After searching, I found many solutions on how to change the last item's style, but in my scenario, the button isn't the element of the ItemsSource. Anyone can help?
Thanks
Add the button to the template so it appears on every element in the ListView. Then use a trigger to show/hide the button based on whether the item is the last item in the list.
One way to do this is to expose the last item in your list via a property on your ViewModel. The trigger should compare the DataContext of the template, which is the current item, against the LastItem. Success should set the visibility of the button.
I hope this helps.

How to force a WPF ComboBox to show its items list?

I have a Button and a hidden WPF ComboBox. When the button is pressed, the ComboBox must be shown and be ready to select an item from its list.
How can the ComboBox drop down list be forced to show programmatically?
To open the drop down.
combo.IsDropDownOpen = true;
Have you tried:
ComboBox1.DroppedDown = True

WPF SelectedItem and Scrolling

I have a WPF DataGrid. The DataGrid is bound to an IList. The list has many many items so the DataGrid MaxHeight is set to a predefined value and the DataGrid automatically displays a scroll bar. The selection mode and unit are set to "single full row".
The form has a button called "New" that adds an item to the list that the datagrid is bound to.After "New" is clicked, the new item should be the new selected item. I do this via : dataGrid.SelectedItem = newItem;
This works ..but not as well as I expect it to.
I also want the dataGrid to scroll down to the newly selected item .. Any idea on how to do this ?
Regards,
MadSEB
After you set the SelectedItem, make sure to call DataGrid.ScrollIntoView with the new item. This will make sure that the new item is visible on screen.

Wpf Data entry Form bound to datatable

I was trying my hand on binding in Wpf.I am trying to make a dataenrty screen.for instance,I have a textbox and a combobox and a listview.. users enter pick an item from the combobox,add a comment and add the item to the listview.This is the flow.I have a master table for the combobox,i have its selectedvalue bound to a Item field in the ordertable and the textbox.text bound to comments field in order table.fine up to now.
from here on i'm confused,should i bind the lsitview to the order table?.If yes then how will i create a new row in the datatable each time add row is clicked..?
if a new row is created in the datatable,next time the user selects an item it should be bind to the newly created row...how can i do this...pls help...i'm pulling my hairs on this...
you can see this
http://dotnetstories.wordpress.com/2009/03/28/create-a-simple-data-centric-wpf-application/

Resources