ListBox と Label を持つ単純なウィンドウがあります。Label.Text を ListBox にバインドして、Label に表示されている選択されたものの次の listBox の Item になるようにしたいと思います。次のようなコンバーターでマルチバインディングを使用しようとしました。
<Label>
<MultiBinding Converter="{StaticResource myConverter}">
<Binding ElementName="lbox" Path="Items"/>
<Binding ElementName="lbox" Path="SelectedIndex"/>
</MultiBinding>-->
</Label>
public class MyConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
object[] items = values[0] as object[];
int index = (int)(values[1]) + 1;
return (items[index]).ToString();
}
.....
}
しかし、うまくいきません。問題は、ListBoxItems の配列を取得できないことです。助けてください。