Xamarin表单-从XAML绑定访问多维数组的值
我不知道这是否可能,但我正在尝试从我的XAML文件中访问二维数组的一个元素首先,这可能吗? 我正在自己制作一个自定义日历(与WriteLine输出一起使用)。我现在试着把它做成图形 C部分有一部分: 现在,在我的XAML中,我想访问Xamarin表单-从XAML绑定访问多维数组的值,xaml,multidimensional-array,grid,Xaml,Multidimensional Array,Grid,我不知道这是否可能,但我正在尝试从我的XAML文件中访问二维数组的一个元素首先,这可能吗? 我正在自己制作一个自定义日历(与WriteLine输出一起使用)。我现在试着把它做成图形 C部分有一部分: 现在,在我的XAML中,我想访问GetDayBackgroundColor()函数中这个GridData、数组等示例的元素 XAML零件: <!-- Grid Planning part --> <AbsoluteLayout BackgroundColor="White"
GetDayBackgroundColor()
函数中这个GridData、数组等示例的元素
XAML零件:
<!-- Grid Planning part -->
<AbsoluteLayout BackgroundColor="White"
AbsoluteLayout.LayoutBounds="0.5, 0.71, 1, 0.79"
AbsoluteLayout.LayoutFlags="All">
<Grid BackgroundColor="Transparent"
AbsoluteLayout.LayoutBounds="0.5,0.95,0.9,0.7"
AbsoluteLayout.LayoutFlags="All">
<Grid.RowDefinitions>
<RowDefinition Height="5*"/>
<RowDefinition Height="15*"/>
...
<RowDefinition Height="5*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="14*"/>
...
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<!-- Here is the interesting part -->
<AbsoluteLayout Grid.Row="1" Grid.Column="1" BackgroundColor="Black">
<Label Text="{Binding GetDayNumber {00}}" TextColor="White" BackgroundColor="Transparent" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"
AbsoluteLayout.LayoutBounds="0.5,0.5,1,1"
AbsoluteLayout.LayoutFlags="All"/>
</AbsoluteLayout>
</Grid>
</AbsoluteLayout>
...
...
它不起作用。。我还尝试了Text=“{Binding Path=Calendar[y][x].Day}”
(其中x&y是二维数组中的位置),但没有成功
有人知道我怎么处理吗
提前感谢 对于一个数组维度,它可以工作 它不是UWP或WPF 在后端代码中使用,在视图模型中切换到所选的第二个参数,并以单数组格式显示。尝试模式“双向”
<!-- Grid Planning part -->
<AbsoluteLayout BackgroundColor="White"
AbsoluteLayout.LayoutBounds="0.5, 0.71, 1, 0.79"
AbsoluteLayout.LayoutFlags="All">
<Grid BackgroundColor="Transparent"
AbsoluteLayout.LayoutBounds="0.5,0.95,0.9,0.7"
AbsoluteLayout.LayoutFlags="All">
<Grid.RowDefinitions>
<RowDefinition Height="5*"/>
<RowDefinition Height="15*"/>
...
<RowDefinition Height="5*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="14*"/>
...
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<!-- Here is the interesting part -->
<AbsoluteLayout Grid.Row="1" Grid.Column="1" BackgroundColor="Black">
<Label Text="{Binding GetDayNumber {00}}" TextColor="White" BackgroundColor="Transparent" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"
AbsoluteLayout.LayoutBounds="0.5,0.5,1,1"
AbsoluteLayout.LayoutFlags="All"/>
</AbsoluteLayout>
</Grid>
</AbsoluteLayout>