0

我有一个带有 mvvm 的应用程序。在我的 ViewModel 中,我有 2 个 ObservableCollection。其中一个像这样绑定好:

        <phone:LongListSelector
                Margin="0,0,0,5"
                ItemsSource="{Binding ItemSourceMatrix}"
                x:Name="LongListSelector_Matrix" 
                Loaded="Event_LongListSelector_OnLoaded_Matrix"
                ItemTemplate="{StaticResource Matrix}"
                GridCellSize="20, 20"
                LayoutMode="Grid"
                FontSize="10"
                Padding="10,0,-5,0" Tap="asd" 
                                     />
        </phone:PanoramaItem>

但现在我需要从另一个 ObservableCollection 绑定到这个 LongListSelector,如下所示:

        <phone:PanoramaItem Header="SE Матрица">
            <phone:LongListSelector
                Margin="0,0,0,5"
                ItemsSource="{Binding ItemSourceMatrix}"
                x:Name="LongListSelector_Matrix" 
                Loaded="Event_LongListSelector_OnLoaded_Matrix"
                ItemTemplate="{StaticResource Matrix}"
                GridCellSize="20, 20"
                LayoutMode="Grid"
                FontSize="10"
                Padding="10,0,-5,0" Tap="asd" 

                Background="{Binding  Source= ItemSourceMatrixBackground, Path=Colors_Value, Mode=OneWay}"
                                     />
        </phone:PanoramaItem>

但是上面的代码 (Background="....) 不起作用。有我的模板:

    <!--   Matrix   -->
    <DataTemplate x:Key="Matrix">
        <TextBlock  x:Uid="{Binding Matrix_Name}" 
                    Text="{Binding Matrix_Text, Mode=TwoWay}"
                    FontSize="{Binding Matrix_FontSize}"
                    Foreground="{Binding Matrix_Foreground}"                     
                   />
    </DataTemplate>
4

0 回答 0