Click here to Skip to main content
15,891,943 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a dynamic listBox:
XAML
<ListBox Margin="182,150,201,249" Name="myListCode">
    <ListBox.ItemTemplate>
        <DataTemplate>
            <StackPanel>
                <CheckBox Content="{Binding}" IsChecked="True" />
            </StackPanel>
        </DataTemplate>
    </ListBox.ItemTemplate>
</ListBox> 

I want to get just the selected values.

Any help please?
Thanks in advance,

What I have tried:

myListCode.SelectedItem
but I get null.
myListCode.SelectedItems
but I get 0.
Posted
Updated 18-Dec-18 5:54am
v3
Comments
Vincent Maverick Durano 17-Dec-18 8:01am    
Doesn't seems like an ASP.NET ListBox to me. Is this a Xamarin Forms app?
Member 13751744 17-Dec-18 10:29am    
no, it's WPF
Vincent Maverick Durano 17-Dec-18 18:50pm    
then you should replace the ASP.NET tag to WPF in your question

1 solution

Not a WPF guy, but I found this discussion that may help you get started: Get selected items from checkbox in a list - C# WPF - Stack Overflow[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900