I've tried to bind IsHitTestVisible
of a GridViewItem
using MVVM. I've updated the value from "False" to "True" of the particular Model and notified View using INotifyPropertyChanged
. But it is not affecting in the view. But if I bind value directly for IsHitTestVisible
in the setter, its working fine. Anyone can help on this?
<GridView
Grid.Row="1"
Name="gvCatalogue"
Width="Auto"
Height="Auto"
HorizontalAlignment="Left"
HorizontalContentAlignment="Left"
ItemsSource="{Binding Path=Catalogue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
IsItemClickEnabled="True" >
<GridView.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel Orientation="Horizontal" Margin="0"/>
</ItemsPanelTemplate>
</GridView.ItemsPanel>
<GridView.ItemContainerStyle>
<Style TargetType="GridViewItem">
<Setter Property="IsHitTestVisible" Value="{Binding Path=HitTestVisible, Mode=OneWay}"/>
</Style>
</GridView.ItemContainerStyle>
<GridView.ItemTemplate>
<DataTemplate>
<Grid Name="ItemGrid" RightTapped="gvItem_RightTapped" Width="230" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" VerticalAlignment="Top" Height="260" Width="175" Orientation="Vertical" HorizontalAlignment="Center" >
<Image Source="{Binding Path=BitmapImage, Mode=OneWay}" Height="250" Width="175" HorizontalAlignment="Center"/>
</StackPanel>
</Grid>
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
In ViewModel, I'm updating the Model "CatalogItem" like this:
private async Task DownloadFile(string fileLocation, string FileName, bool IsZip)
{
CatalogueItem.HitTestVisible = false;
CatalogueItem.DownloadingProgress = Visibility.Visible;
var uri = new Uri(fileLocation);
var downloader = new BackgroundDownloader();
StorageFile file = await ApplicationData.Current.LocalFolder.CreateFileAsync(FileName, CreationCollisionOption.ReplaceExisting);
DownloadOperation download = downloader.CreateDownload(uri, file);
var progress = new Progress<DownloadOperation>(ProgressCallback);
await download.StartAsync().AsTask(progress);
CatalogueItem.HitTestVisible = true;
}