按名称访问静态资源列表框

时间:2011-07-25 22:12:58

标签: c# silverlight xaml listbox

App.xaml
<Application.Resources>
. . . .
<StackPanel>
<ItemsPresenter/>
<ListBox x:Name="comm_box" ItemsSource="{Binding}">
. .. .
</Application.Resources>

错误:当前上下文中不存在comm_box

如何解决此问题? 我在listbox-news之后显示了listbox-news和listbox-comments 但我无法设置comm_box.Itemssource,因为comm_box是不可见的。 请帮我。 http://pastebin.com/DERdgHJ9

1 个答案:

答案 0 :(得分:1)

尝试Application.Current.Resource [“comm_box”]

相关问题