Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@samnaseri
samnaseri / KeepSelectionInView behavior.cs
Created November 29, 2012 01:32
A simple interactivity behavior to keep the a DataGird's SelectedItem into view
using System.Windows.Controls;
using System.Windows.Interactivity;
public class KeepSelectionInView : Behavior<DataGrid>
{
protected override void OnAttached()
{
base.OnAttached();
this.AssociatedObject.SelectionChanged += DataGrid_SelectionChanged;
}
@samnaseri
samnaseri / gist:2234500
Created March 29, 2012 07:24
Attached properties for better WPF Grid layout
namespace Sam
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
public static class Grid
{
@samnaseri
samnaseri / gist:2213903
Created March 27, 2012 08:10
A temporary solution for solving Invalid Object Name 'dbo.__Examination'
// This is for scenarios in which your default schema name is not dbo and hence Entity Framework migration is not working properly.
// WARNING : Please be advised that this is a naive solution which its purpose is to just show how it could be corrected. You may not use this code without understanding and resolving any potential problem.
// For more information go to http://samondotnet.blogspot.com.au/2012/03/why-invalid-object-name.html
namespace ES.DataAccess.Migrations
{
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Model;
using System.Data.Entity.Migrations.Sql;
using System.Linq;
@samnaseri
samnaseri / PaymentController.cs
Created March 27, 2012 00:58
Payment Controller for MIGS gateway using Asp.Net MVC4
// WARNING : THIS CODE IS AS IS. NOTHING IS GUARANTEED.
// PLEASE NOTE THAT THIS IS ONLY A TEMPLATE, YOU NEED TO WORK ON IT TO MAKE IT SUITABLE FOR YOUR NEEDS
// AT LEAST YOU NEED TO REPLACE THE VALUE FOR HASH SECRET VARIABLES BY VALUES YOU RECEIVED FROM YOUR BANK
// For more information go to : http://samondotnet.blogspot.com/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;