locked
Searching using combo boxes

    Question

  • Hello,I have taken 2 combo boxes, a textblock, Hyperlink Button in my store application. I have inserted items in those comboboxes. I have to display the data related to the to items seleted from those comboboxes in into the textblock when i press the hyperlink button. Please paste the code or suggest any links?
    Wednesday, August 27, 2014 9:16 AM

Answers

  • Hi Mummadi,

    You can get the selected items in check boxes using LINQ and add the search inside the button click event. I don't think the Hyperlink Button is the est way to deal it. (if you can use Button )

    You can use this LINQ to get the checked check boxes and its values

    //container may  stack panel that contain your checkboxes.
    //It is the nam of that XAML control 
    var Cb_collection container.Children.OfType<CheckBox>().Where( x => x.IsChecked == true)

    Then implement your code inside whatever click event

    private void b_Click(object sender, EventArgs e) {

    var Cb_collection - container.Children.OfType<checkBox>().Where(x=>x.IsChecked == true);

    //do your operation here foreach(items in Cb_collection) { output_text_block.text += items.value; } }

    Hope that helps
    Please don't forget to up vote answers you like or which help you and mark one(s) which answer your question.

    ---------------------------------------

    M Prabath Maduranga Peiris
    Microsoft Student Partner
    Blogs : prabathsl.blogspot.com



    Wednesday, August 27, 2014 9:44 AM
  • i maked a demo project; https://onedrive.live.com/redir?resid=D1BA3C73BE854A97!81065&authkey=!AMGrYrpCAPE73lE&ithint=file%2czip

    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Wednesday, August 27, 2014 11:35 AM

All replies

  • how are you databinding the comboboxs now?

    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Wednesday, August 27, 2014 9:28 AM
  • How to display the value of two comboboxes in a textblock when we select the items in a combo box?
    Wednesday, August 27, 2014 9:44 AM
  • Hi Mummadi,

    You can get the selected items in check boxes using LINQ and add the search inside the button click event. I don't think the Hyperlink Button is the est way to deal it. (if you can use Button )

    You can use this LINQ to get the checked check boxes and its values

    //container may  stack panel that contain your checkboxes.
    //It is the nam of that XAML control 
    var Cb_collection container.Children.OfType<CheckBox>().Where( x => x.IsChecked == true)

    Then implement your code inside whatever click event

    private void b_Click(object sender, EventArgs e) {

    var Cb_collection - container.Children.OfType<checkBox>().Where(x=>x.IsChecked == true);

    //do your operation here foreach(items in Cb_collection) { output_text_block.text += items.value; } }

    Hope that helps
    Please don't forget to up vote answers you like or which help you and mark one(s) which answer your question.

    ---------------------------------------

    M Prabath Maduranga Peiris
    Microsoft Student Partner
    Blogs : prabathsl.blogspot.com



    Wednesday, August 27, 2014 9:44 AM
  • i maked a demo project; https://onedrive.live.com/redir?resid=D1BA3C73BE854A97!81065&authkey=!AMGrYrpCAPE73lE&ithint=file%2czip

    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Wednesday, August 27, 2014 11:35 AM