Needs multi column dynamic combo box using C#

I need a dynamic Combo box to display multi columns on Drop Down Event 
such as Stock Code, Make, Model,Sub Model, Measurement Type and so on for  my C# Application with Columns Headers 
Please Help Me
Thanks in Advance

You should create a class that represents your model and then you could use a CompositeCollection as the ItemsSource of the ComboBox.
Here is an example for you:
namespace WpfApplication59
public class YourModel
public string StockCode { get; set; }
public string Model { get; set; }
//+ the rest of your properties
MainWindow.xaml.cs:
public partial class MainWindow : Window
public MainWindow()
InitializeComponent();
List<YourModel> models = new List<YourModel>();
models.Add(new YourModel() { Model = "m1", StockCode ="c1"});
models.Add(new YourModel() { Model = "m2", StockCode = "c2" });
cb.ItemsSource = models;
MainWindow.xaml:
<ComboBox x:Name="cb" Grid.IsSharedSizeScope="True" ItemsSource="{DynamicResource items}"
xmlns:local="clr-namespace:WpfApplication59">
<ComboBox.Resources>
<CompositeCollection x:Key="items">
<ComboBoxItem IsEnabled="False">
<Grid TextElement.FontWeight="Bold">
<Grid.ColumnDefinitions>
<ColumnDefinition SharedSizeGroup="A"/>
<ColumnDefinition Width="5"/>
<ColumnDefinition SharedSizeGroup="B"/>
</Grid.ColumnDefinitions>
<Grid.Children>
<TextBlock Grid.Column="0" Text="Model"/>
<TextBlock Grid.Column="2" Text="Stock Code"/>
</Grid.Children>
</Grid>
</ComboBoxItem>
<Separator/>
<CollectionContainer Collection="{Binding Source={x:Reference cb}, Path=DataContext}"/>
</CompositeCollection>
<DataTemplate DataType="{x:Type local:YourModel}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition SharedSizeGroup="A"/>
<ColumnDefinition Width="5"/>
<ColumnDefinition SharedSizeGroup="B"/>
</Grid.ColumnDefinitions>
<Grid.Children>
<TextBlock Grid.Column="0" Text="{Binding Model}"/>
<TextBlock Grid.Column="2" Text="{Binding StockCode}"/>
</Grid.Children>
</Grid>
</DataTemplate>
</ComboBox.Resources>
</ComboBox>
You could restyle the the templates (Grids) as per your requirements.
Please remember to mark helpful posts as answer to close your threads and then start a new thread if you have a new question.

Similar Messages

  • Need Help, retrieving a combo boxes actual/print/visible value instead of the export value.

    Hello,
    I need help, retrieving a combo boxes actual value, not the export value.
    I have a combo box with multiple options to select from.
    each of those selections has a separate export value, which is in the form of a number, which I use to calculate dates in a separate field.
    However, I have another field that i want to retrieve the, users selected value, which is text, from the combo box instead of the export value.
    Is there an easy way to do this.
    This is what I am currently using. But like I said the results are that I retrieve the export value and not the selected text value.
    event.value = this.getField("_Arugula").valueAsString;
    Thanks

    First get the currentValueIndices property of the combo box and use it with the getItemAt field method to return (what I call) the display value. Something like:
    var f = getField("combo1");
    var display_value = f.getItemAt(f.currentValueIndices, false);
    See the documentation for more information

  • Dependent combo boxes using webservice

    Hi All,
    I'm trying to create a depended combo boxes using af:selectOneChoice, using webservice datacontrol. When i try to change the value of the first combo box which has hard coded values (eg. Continent), The depended combo box (eg.Country) is empty. (which is returned via webservice) When i again change the value of the first combo box, I get the corresponding values(Countries) generated. The very first time when a value is selected is not binded to the model. Why is this happening and how to overcome this issue. I tried using the value change listener and assigned the current value to binding but there was no change in the behaviour.

    Thanks for your response Frank. The Sample worked fine. But when i try to implement the same i ran into issues.
    First, I created a combo box for continents and a managed bean.
    <af:selectOneChoice label="Region" id="soc1" autoSubmit="true"
                                  valueChangeListener="#{locateBean.setRegion}">
                <af:selectItem label="Asia" value="Asia" id="si3"/>
                <af:selectItem label="Europe" value="Europe" id="si2"/>
                <af:selectItem label="NA" value="NA" id="si1"/>
              </af:selectOneChoice>Then I created a combo box for countries using the webservice data control.
              <af:selectOneChoice value="#{bindings.Country.inputValue}"
                                  label="Country"
                                  required="#{bindings.Country.hints.mandatory}"
                                  shortDesc="#{bindings.Country.hints.tooltip}"
                                  id="soc2" partialTriggers="soc1">
                <f:selectItems value="#{bindings.Country.items}" id="si4"/>
              </af:selectOneChoice>In the managed bean as
        public void setRegion(ValueChangeEvent event) {
            this.region = (String)event.getNewValue();
        }1. When i run and select an continent, the values are not getting populated in the country combo box. If i refresh the page or select another value for the continent, then its is getting populated.
    2. When i tried to execute the operation manually at pagedef on value change event,
            OperationBinding operBinding = getBindings().getOperationBinding("GetCountryList");
            operBinding.execute();I'm getting an warning as <FacesCtrlListBinding> <getInputValue> ADFv: Could not find selected item matching value Afghanistan of type: java.lang.String in the list-of-values.Why the value binded to the managed bean or model is not getting updated for the first time. Is this the expected behavior.

  • How do i create a Multi column Dynamic list using Swing?

    Hi,
    I need to be able to do a file search (in a separate thread) on the hard drive and display the results in a multi column List control .
    Jtable seems to be rather 'static'y. i.e load data in once. and maybe reload it again later. But i need to load one row in at a time as the search progresses.
    Also any row can be deleted or moved to another position.
    CListCtrl in MFC allows me to do this handily.
    But Is there a way to do this using Swing?
    havent seen anything that says JList can do this.
    TIA

    Hi Jacob.
    I would use JTable for that. I did not exactly understand what you meant by JTable being "static"y.
    Anyway, I would have the thread update the data in the tablemodel behind the table and invoke "fireTableRowsInserted" (may be after every insert or after inserting a chunk of rows). I had a sample something similar to what you are working on. Let me know if you need the sample.
    HTH.
    Regards,
    Vijay

  • Locating on a location on GMap using combo box using SDK

    Hi All,
    I have a requirement to locate a city on google map using combo box. I want name of cities to appear in combo box and on selecting a city, map should be able to locate that city. This combo box will be visible on map itself. Combo box can be a component of either Xcelsius or Flex Builder.
    I think combo box dragged from Xcelsius component panel not able to communicate with google map which is embedded in form of swf through manage and packager.
    So, I tried with Flex Builder combo box component, but not able to done it. I am not getting the flow how to communicate between combo box and google map.
    I can locate a particular city giving a latitude and longitude through propertysheet.
    Please, if anyone could help me out asap.
    Thanks in advance!

    Hi Monammed,
    The said functionality should work. Please check your logic one more time. Also, try using some spreadsheet components mapped to the cells in question and understand how the data is flowing during run-time. This will help you test things. Delete spreadsheets when you are done with identifying the issue.
    Lets check the combo box mapping one more time : Map the source of the combo to the entire range; labels in the combo box ONLY to the country column in the source range(typically this may be the left most column in the range); selected item should be mapped to the cell that has the destination for the icon and the type for default selection may be dynamic. Well, if there is any hard-coding of values involved anywhere, do check the spellings and other trivial things.
    Do let me know if this was helpful and if you need any more help.
    Thanks,
    Prasanna

  • Populating a combo box using values in a table

    I am trying to populate a drop down box with values from a table. I have got so far.
    The combo box is populated however the values in the box are blank.
    Can some suggest the necessary modifications?
    $query="select distinct(house_type) from tbl_accommodation";
    $stmt = ociparse($conn, $query);
    ociexecute($stmt);
    echo '<select name="house_type">';
    echo '<option value = "-1">Select:</option>';
    while($row=ocifetch($stmt)) {
         echo '<option>' . $row['house_type'] . '</option>';
         echo '</select>';
    Thanks

    The ocifetch() function needs ociresult() to get the data. See
    http://us.php.net/manual/en/function.oci-result.php
    You might want to use oci_fetch_assoc() instead.
    while($row=oci_fetch_assoc($stmt)) {
      echo '<option>' . $row['HOUSE_TYPE'] . '</option>';
    }For associative arrays, use the column name in upper case.
    NB Oci_fetch_assoc() is a PHP 5 function. If you don't have it, then
    you are using PHP 4 which has a much older version of the OCI8
    extension. I'd recommend upgrading PHP, or just replacing the old
    OCI8 with a newer one. See other recent threads about how to do this.

  • Combo Box Use Global Data issue

    I am using a drop down combo box to select a name, and have checked specifiy item values, am using the item numbers in a switch statement to populate other text boxes depending on selection of drop down.  These same items appear several times in the form, so am setting them to use global data.  All work great except for the textboxes bound using global data to the drop down.  In those results, it's putting the item number, not the text value.  How do I get the text value to show instead of the item value?  Thank you!

    Resolved it by changing the switch statement to use the text value instead of item number, and unchecked the specify item values in the combo box.  I would be interested for future use to learn how to do this, but no worries if not.  At least the form is operating the way it needs to.  Thanks.

  • When i change the value of a combo box using a property node it displays the value not the item label

    I am using a combo box as a select list for text serial commands.  I have items like "engineering", "GUI", and "Scan" for the commands "MDE", "MDN", and MDS respectively which i have input as the corresponding value in the combo box.  so for example the label "engineering" has the value "MDE" in the combo box items list.  when the Vi starts it needs to read the current value MDE, MDN, or MDS and then i want it to display on the front panel the item text corresponding to that command value.
    To do this i have tried to read the serial command, ie MDS and then wire that to a "value" property of a property node of the combo-box, but instead of displaying the corresponding item label, "Scan", it displays the value "MDS" on the front panel instead.  i want the front panel to use the label text when choosing and displaying but the block diagram to use the serial commands.  Can this be done with a combo box?  I'm trying to use a combo box so i can keep it all text and avoid having to build a case statement to convert enums or rings from a numerical value to the text command.
    The correct text value is wired to the value property and it does exist in the combo-box.  I have unchecked "values match items" and selected to not allow undefined values.

    Don't use the value property node.  Use the Text.Text property node.  When creating the property node, select Text, then in the next pop-up box, select Text.
    - tbob
    Inventor of the WORM Global

  • Dynamic Combo Boxes

    Hi,
    I have an interface that has 2 combo boxes; in the first you select a product, in the second a type of that product. Now how is possible to make a dynamic changing content combobox?
    Thanks

    Replace the model of the second box with a new one. i.e. When a selection is made in the first box, use 'box.setModel(...)' and replace the current model with a new one.
    ICE

  • Need guidance for a Combo Box and Keystoke/Validate script

    Hello,
    My goal is to have a combo box selection trigger and enter a value into a text field however the text field needs to be editable.  I want the combo box to determine a default value but changeable by the user if necessary.  Here is the script, I just don't know where to put it.
    if (!event.willCommit) {
    var M1Month = this.getField("Month 1 Pulldown").value; var M1Exp = this.getField("M1 Exp");
    if(M1Month == "January") {M1Exp.value = "1/31/10"};
    if(M1Month == "February") {M1Exp.value = "2/28/10"};
    if(M1Month == "March") {M1Exp.value = "3/31/10"};
    if(M1Month == "April") {M1Exp.value = "4/30/10"};
    if(M1Month == "May") {M1Exp.value = "5/31/10"};
    if(M1Month == "June") {M1Exp.value = "6/30/10"};
    if(M1Month == "July") {M1Exp.value = "7/31/10"};
    if(M1Month == "August") {M1Exp.value = "8/31/10"};
    if(M1Month == "September") {M1Exp.value = "9/30/10"};
    if(M1Month == "October") {M1Exp.value = "10/31/10"};
    if(M1Month == "November") {M1Exp.value = "11/30/10"};
    if(M1Month == "December") {M1Exp.value = "12/31/10"};
    if(M1Month == " ") {M1Exp.value = ""};

    I did not say to take out the line. You need to replace the "" (a null string),  with " " (a space).
    But I would look at using the 'switch' statement that allows for a series of logical test and if none of those specific test has been passed takes a default action.
    You need to put the script in the 'Custom keystroke script'.
    if (!event.willCommit) {
    var M1Exp = this.getField("M1 Exp");
    if(event.changeEx == "January") {
    M1Exp.value = "1/31/10";
    } else if(event.changeEx == "February") {
    M1Exp.value = "2/28/10";
    } else if(event.changeEx == "March") {
    M1Exp.value = "3/31/10";
    } else if(event.changeEx == "April") {
    M1Exp.value = "4/30/10";
    } else if(event.changeEx == "May") {
    M1Exp.value = "5/31/10";
    } else if(event.changeEx == "June") {
    M1Exp.value = "6/30/10";
    }else if(event.changeEx == "July") {
    M1Exp.value = "7/31/10";
    } else if(event.changeEx == "August") {
    M1Exp.value = "8/31/10";
    } else if(event.changeEx == "September") {
    M1Exp.value = "9/30/10";
    }else if(event.changeEx == "October") {
    M1Exp.value = "10/31/10";
    }else if(event.changeEx == "November") {
    M1Exp.value = "11/30/10";
    }else if(event.changeEx == "December") {
    M1Exp.value = "12/31/10";
    }else{
    // all other selections
    M1Exp.value = "";
    } // end not will commit
    You will also need to use the 'event' object's 'changeEx' property.
    If you do not need the selected text, by setting the export value to the expiration date your script could be:
    if (!event.willCommit) {
    this.getField("M1 Exp").value = event.changeEx;

  • Hide a data column in combo box?

    I want to load a combo box from a database with two values per row (add.Item ?) but I only want one value to be see by the end-user.
    Example:
    Hidden | Shown
    12320  |  Green
    19210  |  Red
    72622  |  Yellow
    The user will see the colors but not the numeric values. The numeric values are actually the auto_id for each color in the database. I want to use the auto_id when I save the user's choice to another table instead of the color name.
    Right now as soon as the use selects a color I hit the database for the auto_id number - that can't be good.
    Thanks,
    ADawn
    ADawn

    Hello,
    You would set the data source for the ComboBox that has your data then set DisplayMember to the field to show in the ComboBox along with ValueMember set to the hidden field. Now say in a button click event use ComboBox1.SelectedValue to get the hidden field,
    cast as an integer if that is the data type of the hidden field.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem.

  • Can I Display a Selection or Combo box using MIDP

    Hey All,
    How can I display a Selection or Combo box in My Form Using MIDlet. Please send a Way to do this. Thanks in Advance.

    Hi
    use 'List' for displaying menu..
    check the api for 'javax.microedition.lcdui.List' class
    regards
    williams

  • Set a combo box using script

    Hi, I am building an AIR application that reads in XML to set
    up a form for editing and saving back the XML. I am using the
    standard flash components including the combo box. I am trying to
    set the combo box value to a value in the XML, say for instance
    alignment which only has the possible selection settings of "left",
    "center" or "right". I have looked through the documentation but I
    can't seem to find the right code that will set an existing combo
    box to the desired selection. I know my paths are correct as I can
    call the open() method to open the combo box. Anyone able to help.
    If I get this sorted and my application is as good as done.
    Cheers,

    have you tried combobox.selectedIndex=#

  • More info needed on BC Dynamic menus and using CSS with them

    Hi all,
    The BC Gurus tutorial on Dynamic Menus and how to style them with CSS made no sense to me, unfortunately. The presentation was too rushed and the screen too small to see what was happening.
    In a previous question I found out how to apply CSS classes to BC menus after a bit of a run around.
    I was putting the # in front of the Item ID name and a . in front of the class name and this was not necessary.
    I have further questions though, as I am still struggling to get a BC Dynamic menu to style properly with the CSS I have created.
    1. If you choose CSS as the menu type, can you set the font, background colour and rollover state of the menu items in the Dynamic menu section? Or do you have to style it all in the CSS stylesheet?
    2. If you choose CSS as the menu type, the option to say how the submenu sits under the root menu disappears. So do you need to set this in the CSS stylesheet? And if so in which element? UL or LI?
    3. If you choose CSS/HTML only, how is this different to the option of CSS for the dynamic menu?
    4. If you choose CSS as the menu type and if you set a width and height in the menu item, and then set a different width and height in the CSS stylesheet, which width and height wins?
    5. If you want a dynamic menu to show on an Android phone, do you have to choose CSS/HTML only and do all the styling in the CSS stylesheet? Or should you avoid dynamic menus all together and just use a UL list in the template? (I am doing a responsive fluid grid layout in DW for the template).
    6. I am finding that the dynamic menu I have done, with CSS as the type, does not show and hide the sub menu items properly on an Android phone. Is there a problem with the javascript in Dynamic menus?
    Thanks for any help you folks can give on these questions!

    .pacnew files are only created if you have modified the default (or a change has been made to the config upstream); in both cases, you should be looking to incorporate the changes.
    It seems some new options are being shipped with lxdm: you want those in your config (turning them on or off is a matter for you and the man page to sort out)...

  • Need code for Dynamic check box creation in struts

    dynamic checkbox should be created with details of data stored in database(with check mark for already selected check box).
    once user make any change to that page and click submit the result ahould be saved in database..
    can anybody explain me how to proceed this.
    If any sample source code you have plz do sent me..

    consider these are the details in database
    1. apple checked
    2. orange
    3. mango
    4. grapes checked
    consider a jsp page which should display list of fruits in the datsbase,
    the jsp page should retrieve these data and diaplay with check box.
    These should be generated dynamically.
    Assume the jsp page has option for user to enter some other fruit name which should be updated into database of fruits and that should be displayed with the jsp page during next visit.(i.e) number of fruits in the database is not constant.

Maybe you are looking for

  • After 2 years of not having a PC i now have a laptop... I downloaded iTunes.  How can I retrieve my music library???

    After 2 years of not having a PC i recently purchased and ASUS laptop and downloaded iTunes.  How can I retrieve my music library? I thought I backed it up on an external hard drive, but I can't import the files to my library... I also still have my

  • IOExecption in palm

    Hi, i have some problems with my application. My program is running in a palm tx with j9 Vm, and it send some information with http post to a php server. All work fine when i have an active wifi connection, but when the palm dont find any wifi connec

  • Calling SQL Loader from SQL Plus

    Hi everyone, I currently use both SQL Loader and SQL Plus to load data and to then carry out certain DML tasks and to reinstate indexes. That all works fine but of course I need to be present to start and to monitor the various scripts. What I would

  • What is wrong with the wi-fi synce in iTunes for Windows?????

    I've attempted at least 12 times to transfer some photos from iPhoto to my laptop but it seems impossible at this point unless i connect a cable.  I have some photos that collected from the web that I shared to iTunes with the iPhoto app for my iPad.

  • Regarding roll back and reassign the value.

    hi all, i am using forms6i. Re: how to avoid the form's message situation as we discussed my process has to happen like this. since it is a new topic so i have raised new thread. what i want to do is based on the input values(base table values) i hav