I tried already few different ways with the same results - combo is empty.
<Window
xmlns="
http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="
http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="
http://schemas.microsoft.com/expression/blend/2006"
xmlns:mc="
http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns
ial_Services="clr-namespace
ial.Services;assembly=Dial.Services"
xmlns
ial_ManagerView_Services="clr-namespace
ial.ManagerView.Services;assembly=Dial.ManagerView.Services"
x:Class="ManagerView.UploadListWindow"
x:Name="Window"
Title="UploadListWindow"
Width="504" Height="466" Background="#FF000000" Loaded="Window_Loaded">
<Window.Resources>
<ObjectDataProvider x:Key="MappingBindingListDS" d:IsDataSource="True"
ObjectType="{x:Type Dial_ManagerView_Services:MappingExtenderBindingList}"/>
<!--Dial_ManagerView_Services:StringCollection x:Key="StringCollectionDS"
/--> - this was one of the options.
<DataTemplate x:Key="MappingBindingListTemplate" >
<Grid Width="321" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.491*"/>
<ColumnDefinition Width="0.509*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="0.603*"/>
</Grid.RowDefinitions>
<TextBlock x:Name="textBlockSource" Grid.ColumnSpan="1" Grid.Row="0"
Grid.RowSpan="1" Text="{Binding Path=Source}"/>
//HERE Few versions of the same line
//1) I just added available fields to the collection itself (and to each
item just to experiment
<ComboBox HorizontalAlignment="Left" x:Name="comboDestination"
VerticalAlignment="Bottom" Grid.Column="1" Grid.Row="0"
ItemsSource="{Binding Source={StaticResource StringCollectionDS}"/>
2)
<ComboBox HorizontalAlignment="Left" x:Name="comboDestination"
VerticalAlignment="Bottom" Grid.Column="1" Grid.Row="0"
ItemsSource="{Binding Source={StaticResource MappingBindingListDS} />
</Grid>
</DataTemplate>
</Window.Resources>
<Grid x:Name="LayoutRoot">
<ListBox Margin="20,152,36,47" x:Name="listBoxBindings"
IsSynchronizedWithCurrentItem="True" ItemTemplate="{DynamicResource
MappingBindingListTemplate}" ItemsSource="{Binding Mode=OneWay,
Source={StaticResource MappingBindingListDS}}"/>
</Grid>
</Window>
In code I just do listBoxBindings.ItemsSource=<collection>. I get with
TextBlock bound but not combobox.
Thanks
Nicholas Paldino said:
Shimon,
It shouldn't be too hard, actually. How are you currently trying to do
it (through XAML/code, and provide the XAML/code)?
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
Shimon Sim said:
I can't figure out how to bind ComboBox inside of ListView or ListBox.
How do I set ComboBox.ItemsSource property?
I don't see the way to do it in code and not in XAML.
I have Collection that is bound to ListBox / ListView and string[] that
should be bound to ComboBox.
Thanks,
Shimon.