private void ViewFile_Click(object sender, RoutedEventArgs e) { var o = Grid1.SelectedItem as ContractFilesGridItem; FilingManager.DownloadContractFile(CurrentContract.Contractid, (ContractIndex)o.DocumentIndex, o.FileId, this.layoutRoot); }