class DownloadLinkExtended : DownloadLink {
public DownloadLinkExtended(DownloadLink origDl){
PropertyInfo[] myObjectProperties = origDl.GetType().GetProperties(); //BindingFlags.Public | BindingFlags.NonPublic
foreach (PropertyInfo pi in myObjectProperties)
{
object value = pi.GetValue(origDl, null);
if (value != null)
{
try
{
pi.SetValue(this, value, null);
}
catch (Exception) {
//selze to na komplexnim typu jako napr. PostData
}
}
}
}
public string NewUrl { get; set; }
public string NewIdOnFilehost { get; set; }
}
But well that reflection does not work and i don't have it set up like DownloadLinkExtended.DownloadLink because then every grid bound column would need to be DownloadLink.field and i don't want it that way. Also setting it in constructor for each property individually is to much error prone manual work.IList<GridViewRow> rows = radGridView.ChildrenOfType<GridViewRow>();But since there is no .Rows this it seams to me that it is not your recommended way.
************** Exception Text
**************
System.InvalidOperationException: The calling thread cannot
access this object because a different thread owns it.
at
System.Windows.Threading.Dispatcher.VerifyAccess()
at
System.Windows.Threading.DispatcherObject.VerifyAccess()
at
System.Windows.DependencyObject.GetValue(DependencyProperty dp)
at
System.Windows.Controls.ContentControl.get_Content()
at
Telerik.Windows.Controls.DragDrop.UndetectableWindow.set_Child(FrameworkElement
value)
at
Telerik.Windows.Controls.DragDrop.DesktopDragDropProvider.Reset()
at
Telerik.Windows.Controls.DragDrop.DesktopDragDropProvider.OnLeftMouseButtonUp(Object
sender, MouseButtonEventArgs e)
at
System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate
genericHandler, Object genericTarget)
at
System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object
target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object
target, RoutedEventArgs routedEventArgs)
at
System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs
args, Boolean reRaised)
at
System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs
args, RoutedEvent newEvent)
at
System.Windows.UIElement.CrackMouseButtonEventAndReRaiseEvent(DependencyObject
sender, MouseButtonEventArgs e)
at
System.Windows.UIElement.OnMouseUpThunk(Object sender, MouseButtonEventArgs
e)
at
System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate
genericHandler, Object genericTarget)
at
System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object
target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object
target, RoutedEventArgs routedEventArgs)
at
System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs
args, Boolean reRaised)
at
System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs
args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean
trusted)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at
System.Windows.Input.InputProviderSite.ReportInput(InputReport
inputReport)
at
System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode
mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32
wheel)
at
System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, Int32
msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at
System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg,
IntPtr wParam, IntPtr lParam, Boolean& handled)
at
MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr
lParam, Boolean& handled)
at
MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at
System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback,
Object args, Boolean isSingleParameter)
at
System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate
callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object
args, Boolean isSingleParameter, Delegate catchHandler)
at
System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority,
TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority,
Delegate method, Object arg)
at
MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam,
IntPtr lParam)
at
System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at
System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
at
System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason,
ApplicationContext context)
at
System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason,
ApplicationContext context)
at System.Windows.Forms.Application.Run(Form
mainForm)
at Xm8.App.X.Program.ShowControlCenter(ControlCenterParameters
ccParams)
at Xm8.App.X.Program.ShowCC(Object parameter)
at
System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at
System.Threading.ExecutionContext.Run(ExecutionContext executionContext,
ContextCallback callback, Object state)
at
System.Threading.ThreadHelper.ThreadStart(Object obj)
public static double Percent<
TSource
>(IEnumerable<
TSource
> source, Func<
TSource
, int?> selector)
{
return (source.Select(selector).Aggregate(0, (t1, t2) => t1 + (int)t2) * .01);
}