日期:2014-05-17  浏览次数:20671 次

wpf 我在vm里有个List属性.怎么绑定?
vm里有个List属性Lc2
  <ListBox Height="283" HorizontalAlignment="Left" Margin="206,20,0,0" Name="listBox2" VerticalAlignment="Top" Width="462" 
            ItemsSource="{Binding Lc1}"  
                 >
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <ListBox ItemsSource="{Binding Lc2}" Name="listBox3">
                    </ListBox>
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox> 

Lc1和Lc2是两个独立的List属性.
单个listBox2绑定Lc1是没问题的.
但是嵌套了一个listBox3后,listBox3就绑定不了Lc2了.
高手能帮忙看看吗

------解决方案--------------------
引用:

没有大师进来吗


引用:

没有大师进来吗


我来拯救你吧
呵呵
是这样的 你的问题在于
<ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid>