<ListBox x:Name="noteListBox"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch" Foreground="#FF329BD6" Margin="0,24,0,85">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock x:Name="noteTitle"
FontSize="40"
Text="{Binding Titolo}"
Tag="{Binding FileName}"
Foreground="#FF45B1EE" Tap="apriNota" Margin="5,0,0,0" />
<TextBlock x:Name="noteDateCreated"
Text="{Binding DateCreated}"
Margin="10,0,0,10" Foreground="#FF60ADD8" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
TextBlocks
内のこれら 2 つの前景色を動的に変更する必要がありますStackPanel
。問題は、それらが私の C# コードからアクセスできないように見えることですStackPanel
。
だから基本的にこれは私がする必要があることです:
noteTitle.Foreground = new SolidColorBrush(Color.FromArgb(255, 50, 155, 214));
しかし、C# コードでさえ見つけることができませんnoteTitle
...どうすれば修正できますか?
ありがとうございました!