Silverlight autocompletebox validate item selected - silverlight

I just need to validate that at least one item in an autocompletebox has been selected (meaning the textbox is not blank) when a button is clicked.
My list etc is working fine ... Im just not sure how to do validation. In fact this is the first of any such silverlight validation I've done as the bulk of our work is readonly dashboard type screens.

Related

Form template with controls as TabPage

I have a tabpage which displays a summary of records in my database, when the user clicks a row a new tabpage opens, this uses a form as a 'template' which has textboxes, the textboxes will display the detailed data from the specific row.
The stumbling point I am at is I can get to the point where the new tabpage opens with the form template displayed but I dont know how to fill the textboxes on the new tabpage / form with the data from the database (based on the row the user selected). How do I reference the textboxes on the new tabpage and assign them the appropriate fields? Do I bind the 'templates' textboxes and then fill them with a query?
I have tried this...
Me.tabMain.TabPages(NewTab).Controls(frmRecipeDisplay.Controls(txtVersion).Text = "test")
But this causes an error.
This app is in VB.NET.
Any help is appreciated.

Combobox List passing string

I have a VB6 application that has been running for quite sometime. Currently I'm trying to update one of the form that has a combobox 2.0. Because the combobox is populated with hundreds of items - I'm trying to update it so that users are able to click on a look up button next to it, where another window opens up with all the items from the combobox. User will be able to search by keyword and/or select an item and double click on it and have it appear in the combobox. The issue I'm having is with trying to pass no value or "" when CANCEL is clicked. I'm able to pass the value if I in the properties window my STYLE Is set to COMBO rather than list. However, the issue I come across is that with COMBO the value (text) in the combobox sometimes is not aligned properly. Is there a way to pass a "" value to a combobox 2.0 without changing the style to COMBO?
If they hit cancel set the ListIndex of your combo to -1 rather than setting the text property. This is the value for no item being selected.

How to add CheckBoxes to a ComboBox?

I want to create a ComboBox having Checkboxes as children using Codename one.
I am not using the UIBuilder
For reusability I created a Container having three Checkboxes in it:
OverviewCheckBoxContainer
- Checkbox1
- Checkbox2
- Checkbox3
and this works already.
As it takes too much space on the screen, I now tried to add the CheckBoxContainer into a Combobox, like this:
ComboBox
- OverviewCheckBoxCont
-...
but it does not work, the ComboBox contains a single entry only and it's not a checkbox, but a text:
OverviewCheckBoxCont[x=...
(cannot see further on the screen)
How can I solve this issue, so there is a dropdown menu containing the three Checkboxes, that toggle onClick?
ps:
In the main form I added the CheckBoxesComboBox instead of the CheckBoxesCont:
this.add(BorderLayout.CENTER, checkBoxesComboBox)
instead of
this.add(BorderLayout.CENTER, checkBoxesCont)
1.You can use simple combobox as shown below
ArrayList al = new ArrayList();
findComboBox().setModel(new DefaultListModel(al));
2.And to add checkbox in combobox , you have to customize the combobox
3.Instead of customizing combobox, You can use button which shows and hides OverviewCheckBoxContainer which contains list of checkboxs
See this for customizing the ComboBox with the generic list cell renderer: https://www.codenameone.com/manual/components.html#_combobox
The problem with using checkboxes in a combo is that you would assume they would all appear in the combo as a set and the combo wasn't designed to do that. I would instead just use a Button and show a dialog with a set of checkboxes then set the text of the Button to match the result. You can style the button to look like a ComboBox if that is your preference.

WPF Toolkit Data Grid , Selected Item Prevent changing

I have a WPF Toolkit DataGrid,
First Item is selcted
User clicks on any other item on the Grid
I do some validations (any validation on selection change event of the WPF Toolkit DataGrid)
If validations returns false
I want prevent User from changing the previously selected Item
I tried saving previous index in a variable and set it again but it's not working
look at ICollectionView event Currentchanged, Currentchanging and the MoveCurrentTo methods.
this.MyGridItemsSource = new ObservableCollection<MyDataItems>();
this.view = (ICollectionView)CollectionViewSource.GetDefaultView(this.MyGridItemsSource)
this.view.CurrentChanging += your eventhandling goes here

silverlight combobox - highlight a few items in the popup list

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?

Resources