<Window.Resources>
<DataTemplate x:Key="key_t"/>
</Window.Resources>
<ListBox />
How do i bind window.resource dynamically to listbox ?
Since you specifically asked for dynamic binding:
<ListBox ItemTemplate="{DynamicResource key_t}"></ListBox>
However, I don't see why you'd need dynamic binding in your example. Thus, I'd suggest to use static binding instead:
<ListBox ItemTemplate="{StaticResource key_t}"></ListBox>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.