值不能为 null。参数名: current
at System.Windows.LogicalTreeHelper.GetChildren(DependencyObject current)
at System.Windows.Documents.FixedPage._CreateChildIndex(DependencyObject e)
at System.Windows.Documents.FixedTextView.GetTextPositionFromPoint(Point point, Boolean snapToText)
at MS.Internal.Documents.TextViewBase.System.Windows.Documents.ITextView.GetTextPositionFromPoint(Point point, Boolean snapToText)
at MS.Internal.Documents.DocumentPageTextView.GetTextPositionFromPoint(Point point, Boolean snapToText)
at MS.Internal.Documents.MultiPageTextView.GetTextPositionFromPoint(Point point, Boolean snapToText)
at MS.Internal.Documents.TextViewBase.System.Windows.Documents.ITextView.GetTextPositionFromPoint(Point point, Boolean snapToText)
at System.Windows.Documents.TextEditorMouse.IsPointWithinInteractiveArea(TextEditor textEditor, Point point)
at System.Windows.Documents.TextEditorMouse.OnQueryCursor(Object sender, QueryCursorEventArgs e)
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.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at System.Windows.Input.MouseDevice.UpdateCursorPrivate()
at System.Windows.Input.MouseDevice.PostProcessInput(Object sender, ProcessInputEventArgs e)
at System.Windows.Input.InputManager.RaiseProcessInputEventHandlers(ProcessInputEventHandler postProcessInput, ProcessInputEventArgs processInputEventArgs)
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, WindowMessage 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, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
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(IntPtr 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 WindowsFormsApp1.Program.Main() in C:\Users\ruanbh\Desktop\WindowsFormsApp1\Program.cs:line 18
DataTable dt = new DataTable();
dt.Columns.Add("DOCTOR_IMG", typeof(byte[]));
DataRow dr = dt.NewRow();
dr["DOCTOR_IMG"] = File.ReadAllBytes("butterfly.jpg");
dt.Rows.Add(dr);
this.grdGiveDrug.ItemsSource = dt.DefaultView;
<DataGrid Name="grdGiveDrug" HorizontalAlignment="Left" Height="157" Margin="55,83,0,0" VerticalAlignment="Top" Width="334">
<DataGrid.Columns>
<!--医生签名-->
<DataGridTemplateColumn MinWidth="78" Width="*">
<DataGridTemplateColumn.HeaderTemplate>
<DataTemplate>
<Border ClipToBounds="True" BorderBrush="Black" BorderThickness="0,0,1,1">
<Label Content="医生签名" />
</Border>
</DataTemplate>
</DataGridTemplateColumn.HeaderTemplate>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Image Height="23" Width="70" Source="{Binding Path=DOCTOR_IMG}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>