loop
loop

Reputation: 9242

how to show that a grid in gridview is selected in windows 8 app

I want to show grid view grid tile selected like an image i have added selected tile http://www.google.co.in/imgres?um=1&sa=N&rlz=1C1CHMO_enIN532IN532&biw=1366&bih=667&hl=en&tbm=isch&tbnid=a7OwOgEUi8RQWM:&imgrefurl=http://www.telerik.com/help/aspnet-ajax/tilelist-selection.html&docid=AzRzczojIstprM&imgurl=http://www.telerik.com/help/aspnet-ajax/media/tileList-selected-tile-appearance.png&w=327&h=170&ei=D4HNUcutJYeFrgeuy4HgDg&zoom=1&ved=1t:3588,r:0,s:0,i:78&iact=rc&page=1&tbnh=136&tbnw=261&start=0&ndsp=17&tx=73&ty=66

Upvotes: 0

Views: 119

Answers (1)

VasileF
VasileF

Reputation: 2916

You should create a different question for a different issue. Anyways, if you want to customize the looks of many visual items on the page, you will need to override the default resource brush.

You have a big list here (scroll down to the bottom of the post on the page, until you get to the ones with SolidColorBrush.

You're using a GridView and there's nothing for gridview on that list. I am not sure but I think ListView and GridView resource brushes are the same.

You can try to see if there are any resources for the GridView, or, style a ListView entirely as a GridView. A ListView can be easily changed to look like a GridView like this (I changed the template of the panel in which the items are shown) :

<ListView x:name="MyListView"
          SelectionMode="Single">
    <ListView.ItemsPanel>
        <ItemsPanelTemplate>
            <WrapGrid Orientation="Vertical"/>
        </ItemsPanelTemplate>
    </ListView.ItemsPanel>
</ListView>

Now, for applying those resource brushes from the link, you have to write in the App.xaml file, the ThemeDictionary (in the interior of the ResourceDictionary) :

<ResourceDictionary.ThemeDictionaries>
    <ResourceDictionary x:Key="Default">
        <!-- Changed ThemeBrsuh default color for selected item within ListView -->
        <SolidColorBrush x:Key="ListViewItemSelectedPointerOverBorderThemeBrush" Color="#A8A8A8" />
         <SolidColorBrush x:Key="ListViewItemPointerOverBackgroundThemeBrush" Color="Transparent" />
         <SolidColorBrush x:Key="ListViewItemSelectedPointerOverBackgroundThemeBrush" Color="DimGray" />
         <SolidColorBrush x:Key="ListViewItemSelectedBackgroundThemeBrush" Color="#A8A8A8" />
     </ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>

This will override the default colors for all your ListViews in your app. You can't have one with a red theme and another with a blue theme. I don't know if it's possible, so far I haven't found any solutions.

Still, I hope this one helps you out in your matter.

Upvotes: 1

Related Questions