Establezca la columna Fila en una vista de cuadrícula en una aplicación de la tienda de Windows
Frecuentes
Visto 706 equipos
0
i created a GridView and all its rows are in the same color, i which i can modify these.
mi código :
GridView gridView = new GridView();
gridView.Items.Add("item 1 ");
gridView.Items.Add("item 2 ");
gridView.Items.Add("item 3 ");
they are all displayed in the gridview background color:
i want to change the GridView properties like color..., How can i proceed ?
i'm using C# and XAML.
1 Respuestas
0
If you want to style specific items, declare an item template. -
<GridView ItemTemplate="{StaticResource GridItemTemplate}" />
Then in your Pages Resources
<DataTemplate x:Key="GridItemTemplate">
<Grid Background="#FF000000>
<TextBlock Text="{Binding ItemsText}" />
</Grid>
</DataTemplate>
To color the whole GridView -
<GridView Background="#FF000000" />
It's definitely recommended to do this through XAML declarations but if you have to do it through C# -
GridView gridView = new GridView();
gridView.Items.Add("item 1 ");
gridView.Items.Add("item 2 ");
gridView.Items.Add("item 3 ");
gridView.Background = new SolidColorBrush(Windows.UI.Colors.Black);
contestado el 28 de mayo de 14 a las 12:05
i don't want the background of the grid view, i want the background of each item. - Redaa
Then you use the ItemTemplate, as shown in the first section of the answer. If you wish it to be different for each GridViewItem then bind the background property to a value in your DataContext. - bradstevenson
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas c# xaml gridview windows-8.1 or haz tu propia pregunta.
why you are using GridView? LongListSelector would be best for your requirement - Sajeetharan
i'm not using windows phone app, i'm using windows 8 app - Redaa