Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7050995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:12:39+00:00 2026-05-28T03:12:39+00:00

I have been Bind the Image and other record in the Listview but i

  • 0

I have been Bind the Image and other record in the Listview but i have problem in binding the record in DataGrid using linq to sql Please tell me how to bind the Image and first name in the DataGrid . I try to bind it but finally the result in my student table is null means no error but it show no record i am sure that i have some binding problem how can i solve it please please tell me and Thanks for reading . Here is My .xml file of wpf please see and correct the errors on this fill

<Window x:Class="UI.ViewStudent"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:local="clr-namespace:UI"
    Title="ViewStudent" Height="577" Width="415" xmlns:my="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit">
    <Window.Resources >
        <local:ImageDataConverter x:Key="ImageData1Converter"/>
    </Window.Resources>

    <Grid Height="540">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="9*" />
            <ColumnDefinition Width="384*" />
        </Grid.ColumnDefinitions>
        <my:DataGrid ItemsSource="{Binding }" AutoGenerateColumns="False" Grid.Column="1" Margin="32,0,53,0" Name="dataGrid1" Height="200" VerticalAlignment="Top">
            <my:DataGrid.Columns>
                <my:DataGridTemplateColumn Header="FirstName">
                    <my:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                         <TextBox Text="{Binding Path=FirstName}" 
                                         Margin="-6,0,-6,0"/>
                        </DataTemplate>
                    </my:DataGridTemplateColumn.CellTemplate>
                </my:DataGridTemplateColumn>

                <my:DataGridTemplateColumn Header="Imagess">
                    <my:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Image Height="100" Source="{Binding Path= MyImage, Converter={StaticResource ImageData1Converter}}" />
                        </DataTemplate>
                    </my:DataGridTemplateColumn.CellTemplate>
                </my:DataGridTemplateColumn>
            </my:DataGrid.Columns>
        </my:DataGrid>
    </Grid >
</Window>

And for my .xml.cs file is

namespace UI
{
    /// <summary>
    /// Interaction logic for Pics.xaml
    /// </summary>
    public partial class Pics : Window
    {
        public Pics()
        {
            InitializeComponent();
        }
        private DataClasses1DataContext db = new DataClasses1DataContext();

        private BindingListCollectionView CustomerView;

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            var custsInCA = from c in db.Students
                            where c.StudentID  == 100
                            orderby c.LastName, c.FirstName
                            select c;

            this.DataContext = custsInCA;
            this.CustomerView = ((BindingListCollectionView)(CollectionViewSource.GetDefaultView(this.DataContext)));
        }

        //public string value { get; set; }
    }

    public class ImageDataConverter : IValueConverter
    {

         public object Convert(object value, Type targetType, object parameter,

         System.Globalization.CultureInfo culture)
         {
            System.Data.Linq.Binary binaryData = value as System.Data.Linq.Binary;
            //System.Data.Linq.Binary binaryData = value;// here there is the first error .How convert BinaryData to Object??
            if (binaryData == null)
            {
                return null;
            }

            byte[] buffer = binaryData.ToArray();
            if (buffer.Length == 0)
            {
                return null;
            }

            BitmapImage res = new BitmapImage();
            res.BeginInit();
            res.StreamSource = new System.IO.MemoryStream(buffer);
            res.EndInit();
            return res;
        }
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
                throw new NotImplementedException();
        }
    }
}

My problem is that i bind the record in DataGrid in wrong way due to that i after compiling i show the Grid but having no record no picture please tell me what is wrong in my my app and how to solve fix it please tell me in completer example how to bind the Image and first name using linq to sql wpf

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:12:40+00:00Added an answer on May 28, 2026 at 3:12 am

    Check there is space after Path=

    <Image Height="100" Source="{Binding Path= MyImage, 
         Converter={StaticResource ImageData1Converter}}" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have been looking on some tutorials for drawing canvas using SurfaceView, but the only
I have been tracking emails for years using a "beacon" image and for those
I have been struggling a while with this problem and read a lot but
Here's my problem. I have an mx:Image within an mx:DataGrid column. If I do
EDIT: Problem was fixed in .NET 4.0. I have been trying to bind a
I have been defined a bind function , b <- function(f,...) function(x) f(x, ...)
I have been trying to bind the StringFormat of the Text property of a
Have been searching how to convert a dictionary to a string. But the results
I have been working with SQL Server as a Developer a while. One thing
Hi, i have been having some problems using JSON data in flash builder lately

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.