locked
Combobox items are repeating in metro apps windows surface

    Question

  • Hi everyone,

            I am developing metro app for windows surface.

    When using combobox, the items are repeating when scrolling.

    and handled one solution for solve this is:

     changed the combobox item template as CarouselPanel to stackpanel.

    If i use this i faced some issues. That is the first item of the combobox is not selecting in some manner.

    How to resolve this?

    Sunday, October 19, 2014 10:37 AM

Answers

  • To achieve this, there is no direct way, you cannot disable one of the Combobox items to be selected.

    But you could have some code while SelectionChanged event fired, for instance try to find out if user is selecting the "--select--" item and tell user to choose another one.

    Or you can add a PlaceHolderText as "--Select--".

    --James 


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, October 20, 2014 7:20 AM
    Moderator
  • Combobox is designed to let you choose one item, use ListView or ListBox to select "all".

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, October 20, 2014 7:28 AM
    Moderator

All replies

  • Hi shaafs,

    Could you share us a minimum demo?

    I can not reproduce the repeating items while scrolling:

            <ComboBox HorizontalAlignment="Left" Height="32" Margin="349,301,0,0" VerticalAlignment="Top" Width="448" >
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <CarouselPanel/>
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
    
                <x:String>asdasdasda2</x:String>
                <x:String>asdasdasda3</x:String>
                <x:String>asdasdasda4</x:String>
                <x:String>asdasdasda5</x:String>
                <x:String>asdasdasda6</x:String>
                <x:String>asdasdasda7</x:String>
                <x:String>asdasdasda8</x:String>
                <x:String>asdasdasda2</x:String>
                <x:String>asdasdasda3</x:String>
                <x:String>asdasdasda4</x:String>
                <x:String>asdasdasda5</x:String>
                <x:String>asdasdasda6</x:String>
                <x:String>asdasdasda7</x:String>
                <x:String>asdasdasda8</x:String>
                <x:String>asdasdasda2</x:String>
                <x:String>asdasdasda3</x:String>
                <x:String>asdasdasda4</x:String>
                <x:String>asdasdasda5</x:String>
                <x:String>asdasdasda6</x:String>
                <x:String>asdasdasda7</x:String>
                <x:String>asdasdasda8</x:String>
            </ComboBox>

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, October 20, 2014 6:33 AM
    Moderator
  • Hi Jamles Hez,

    please see the screen shots:

    1. When i select the comobobox:

    2. When i scroll the items it again that repeating the content:

    • Edited by Shaafs Monday, October 20, 2014 6:44 AM
    Monday, October 20, 2014 6:40 AM
  • Hi Shaafs,

    Maybe I misunderstand your question, so here your question is: you do not want to repeat the combobox items while scrolling, you change the stackpanel here instead of CarouselPanel, and then your first item cannot be select any more. Is that correct?

    As I know CarouselPanel is the default ItemPanel in ComboBox control, after I change to StackPanel, everything gets ok, the first item can be always selected.

    Did I misunderstand something?

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, October 20, 2014 7:07 AM
    Moderator
  • Ya correct jamles.

    And, that is i am add the the first item like "--select--".

    It is not selecting. I already post Here. Please check this.

    Monday, October 20, 2014 7:12 AM
  • To achieve this, there is no direct way, you cannot disable one of the Combobox items to be selected.

    But you could have some code while SelectionChanged event fired, for instance try to find out if user is selecting the "--select--" item and tell user to choose another one.

    Or you can add a PlaceHolderText as "--Select--".

    --James 


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, October 20, 2014 7:20 AM
    Moderator
  • Ya jamles.

    I am sorting the gridview by selecting the combobox item.

    Here if i want to sort see all the items in gridview i want choose the item "all".

    If i choose this the sting is disappeared. this is my another one problem.

    For your Reference.


    • Edited by Shaafs Monday, October 20, 2014 7:27 AM
    Monday, October 20, 2014 7:26 AM
  • Combobox is designed to let you choose one item, use ListView or ListBox to select "all".

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, October 20, 2014 7:28 AM
    Moderator