Skip to main content

Microsoft Silverlight

Answered Question Listbox ItemTemplate DataTemplateRSS Feed

(0)

dipak_narsinghani
dipak_na...

Member

Member

0 points

2 Posts

Listbox ItemTemplate DataTemplate

Hi,

I am using Silverlight 3 Beta ListBox control. Inside that Using ItemTemplate - DataTemplate.

I am not able to insert any control inside DataTemplate.

Thanks in advance.

 

Dipak

jay nanavati
jay nana...

Contributor

Contributor

3388 points

624 Posts

Re: Listbox ItemTemplate DataTemplate

Try this code. it works.

        <ListBox x:Name="mylist">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <Button Content="{Binding}"></Button>
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

and in code behind, just set ItemSource for example:

            mylist.ItemsSource = "j a y".Split();
 

Jay K Nanavaty
www.technologyopinion.com
Mark as answer if it helps. It will also help others...

dipak_narsinghani
dipak_na...

Member

Member

0 points

2 Posts

Answered Question

Re: Listbox ItemTemplate DataTemplate

 Hi Jay,

Thanks for your reply.

I have just find out that it was intelisense problem with vs2008 IDE. After adding the Stack Panel or any other container control without getting intellisense, its working fine now.

 

Thanks again.............

 

Dipak
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities