Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ItemsControl中的WPF多维int数组具有双向_Wpf_Multidimensional Array_Itemscontrol_Two Way Binding - Fatal编程技术网

ItemsControl中的WPF多维int数组具有双向

ItemsControl中的WPF多维int数组具有双向,wpf,multidimensional-array,itemscontrol,two-way-binding,Wpf,Multidimensional Array,Itemscontrol,Two Way Binding,我有一个多维整数数组(向量),我想用TextBox作为DataTemplate显示在ItemsControl中。我使用绑定到向量列表,它是一个列表。int[,]不起作用,因为ItemSource必须是一维的,所以我将其转换为List 此绑定到向量列表单向工作时,文本框都正确显示。但是,two-way不起作用,ItemsControl的ItemSource不会更改,VectorList也不会更新。我做错了什么 XAML: 好的,我现在只使用网格,手动读取/设置文本框。更简单,也更有效:)我还使用

我有一个多维整数数组(向量),我想用
TextBox
作为
DataTemplate
显示在
ItemsControl
中。我使用
绑定
向量列表
,它是一个列表。int[,]不起作用,因为
ItemSource
必须是一维的,所以我将其转换为List

绑定
向量列表
单向工作
时,
文本框都正确显示。但是,
two-way
不起作用,
ItemsControl
ItemSource
不会更改,
VectorList
也不会更新。我做错了什么

XAML:



好的,我现在只使用网格,手动读取/设置文本框。更简单,也更有效:)我还使用了
Int[]
复选框0-false,1-true。它是只读的,但不更新源代码
Int[]
。为什么?它是相同的
ItemsControl
binding。。
<ItemsControl x:Name="itemsControl" ItemTemplate="{DynamicResource DataTemplate_Level1}" ItemsSource="{Binding VectorList, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>

<DataTemplate x:Key="DataTemplate_Level2">
    <TextBox Text="{Binding Path=., Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Height="35" Width="40"/>
</DataTemplate>

<DataTemplate x:Key="DataTemplate_Level1">
    <ItemsControl ItemsSource="{Binding Path=.}" ItemTemplate="{DynamicResource DataTemplate_Level2}">
        <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
                <StackPanel Orientation="Horizontal" />
            </ItemsPanelTemplate>
        </ItemsControl.ItemsPanel>
    </ItemsControl>
</DataTemplate>