Sunday, 27 November 2011

how to sum a column in datatable

If untyped (replace int with the correct data type):
 var sum = table.AsEnumerable().Sum(x=>x.Field<int>(3));
or:
 var sum = table.AsEnumerable().Sum(x=>x.Field<int>("SomeProperty"));
If typed:
 var sum = table.Sum(x=>x.SomeProperty);

Wednesday, 9 November 2011

Sending Key or simulation Key press

 if (e.Key == Key.Down)
        {
            e.Handled = true;
            KeyEventArgs eInsertBack = new KeyEventArgs(Keyboard.PrimaryDevice, 
 Keyboard.PrimaryDevice.ActiveSource, 0, Key.Tab);
            eInsertBack.RoutedEvent = UIElement.KeyDownEvent;
            InputManager.Current.ProcessInput(eInsertBack);
        }

Tab order not working in WPF

<TabControl TabIndex="4" KeyboardNavigation.TabNavigation="Local">

Tuesday, 8 November 2011

How to run WPF - XBAP as Full Trust Application

How to run WPF - XBAP as Full Trust Application

Recently I work on WPF-XBAP application that will run from intranet website: