Binding to multiple indexers

孤街醉人 提交于 2019-12-04 13:27:41

The problem is the {Binding} markup extension - which has a delimiter which is ,.

To work around that you can use the following notation...

<TextBox Width="100" Height="100">
    <TextBox.Text>
        <Binding Path="MyIndexer[1,1]" />
    </TextBox.Text>
</TextBox>

Or use the 'escaped' , with \ - which is also in that link (but somehow they're getting over fact that their original notation doesn't work).

<TextBox Text="{Binding MyIndexer[2\,2]}" Width="100" Height="100" />  

Note that indexer, multi-dimentional array syntax is like this :)...

public string this[int x, int y]
{
    get { return _items[x][y]; }
    set { _items[x][y] = value; }
}
outcoldman

Windows Phone is not a WPF, it is mostly Silverlight, and Silverlight does not support Indexer:

  • Only one-dimensional array indexing is supported.

You can try to fix this by:

a) Try to implement something like Items[0][0], so Items[0] will give you an array to which you again can apply indexer.

b) Try to implement this logic with IValueConverter.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!