I have a small problem.
I am binding an XML File to an itemGridView and an itemListView
The Databind: (Works perfectly fine, just providing what I've done here)
var data = from query in xdoc.Descendants("Colour")
select new ColourClass
{
Colour = "FFFF0000"
};
itemGridView.DataContext = data;
itemListView.DataContext = data;
I want to change the color of the text when the item in the grid is selected (change the color permanently that is). I wrote up this: It doesn't seem to work.
void ItemView_ItemClick(object sender, ItemClickEventArgs e)
{
((ColourClass) e.ClickedItem).Colour = "#FF46FF00";
}
My XAML:
<GridView
x:Name="itemGridView"
AutomationProperties.AutomationId="ItemsGridView"
AutomationProperties.Name="Items"
TabIndex="1"
Grid.RowSpan="2"
Padding="116,136,116,46"
ItemsSource="{Binding}"
ItemTemplate="{StaticResource Standard250x250ItemTemplate}"
SelectionMode="None"
IsSwipeEnabled="false"
IsItemClickEnabled="True"
ItemClick="ItemView_ItemClick"/>
And the standard template:
<DataTemplate x:Key="Standard250x250ItemTemplate">
<Grid HorizontalAlignment="Left" Width="400" Height="60">
<StackPanel VerticalAlignment="Bottom" Background="{StaticResource ListViewItemOverlayBackgroundThemeBrush}">
<TextBlock Text="test" Foreground="{Binding Colour, Mode=TwoWay}" Style="{StaticResource AppIDTextStyle}" Height="60" Margin="15,0,15,0"/>
</StackPanel>
</Grid>
</DataTemplate>
How would I go about changing the colour of a particular item in the Standard 250 template used in gridview?
I have tried to change the colour through databinding itself, but am open to easier ways of doing it.
All I need happening is the colour of the item changing from red to green when the user clicks on the item.