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 3216484
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:18:00+00:00 2026-05-17T15:18:00+00:00

i try to use generate MVVM pattern using Silverlight ListView. But if i bind

  • 0

i try to use generate MVVM pattern using Silverlight ListView. But if i bind data my silverlight control no data visualize. also no error return. i see empty gridview.

Model:

MyData.cs


 public class MyData
    {
        public int ID { get; set; }
        public string Name { get; set; }
        public string Price { get; set; }
        public string Author { get; set; }
        public string Catalog { get; set; }
    }

View:

BookViewer.xaml


<UserControl x:Class="wpf.MVVM.Project.View.BookViewer"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Height="500" Width="700">
    <Grid>
        <StackPanel>
            <ListView Margin="8" Height="400" Width="650" ItemsSource="{Binding Path=MyData}">
         <ListView.View>
                    <GridView >
                        <GridViewColumn Header="ID" Width="Auto">
                            <GridViewColumn.CellTemplate>
                                <DataTemplate>
                                    <TextBlock Text="{Binding ID}" TextAlignment="Right" Width="40"/>
                                </DataTemplate>
                            </GridViewColumn.CellTemplate>
                        </GridViewColumn>
                        <GridViewColumn DisplayMemberBinding="{Binding Path=Name}" Header="Name" Width="100"/>
                        <GridViewColumn DisplayMemberBinding="{Binding Path=Price}" Header="Price" Width="100"/>
                        <GridViewColumn DisplayMemberBinding="{Binding Path=Author}" Header="Author" Width="100"/>
                        <GridViewColumn DisplayMemberBinding="{Binding Path=Catalog}" Header="Catalog" Width="100"/>
                    </GridView>
                </ListView.View>
            </ListView>
        </StackPanel>
    </Grid>
</UserControl>

ViewModel:

MyDataViewModel.cs


  public class MyDataViewModel
    {
       // public ObservableCollection<MyData> myData { get; set; }
        public List<MyData> GetData()
        {
            List<MyData> myDataList = new List<MyData>();
            myDataList.Add(new MyData() { ID = 1, Name = "yusuf karatoprak", Author = "Mike Gold", Price = "6.7 TL", Catalog = "IT" });
            myDataList.Add(new MyData() { ID = 2, Name = "yusuf karatoprak", Author = "Scott Gunitella", Price = "9.7 TL", Catalog = "IT" });
            myDataList.Add(new MyData() { ID = 3, Name = "yusuf karatoprak", Author = "David Hayden", Price = "11.7 TL", Catalog = "IT" });
            if (myDataList.Count > 0)
            {
                return myDataList;
            }
            else
                return null;
        }

    }

Window1.xaml

  public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            MyDataViewModel myDataCtx = new MyDataViewModel();
            MyDataDataView.DataContext = myDataCtx.GetData();
        }
    }

<Window x:Class="wpf.MVVM.Project.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="1000" Width="900"
    xmlns:views="clr-namespace:wpf.MVVM.Project.View" Loaded="Window_Loaded">
    <Grid>
        <views:BookViewer x:Name="MyDataDataView" Margin="0,0,0,0"></views:BookViewer>
    </Grid>
</Window>

i writed these codes but no data i can see.Look below:

alt text

i added 2 pics my debug mode:

alt text
alt text

  • 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-17T15:18:00+00:00Added an answer on May 17, 2026 at 3:18 pm

    As far as I can see you are assigning the list of items directly as your data context therefore your path should just be:

    ItemsSource="{Binding}"
    

    There is no property “MyData” on the list class, this is the datatype which does not need to be specified in the binding as the WPF framework will use reflection to search for all of the properties on MyData

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use WCF Data Service with Subsonic, but ran into this error
When I try to use the code below I get a duplicate variable error
I get the above error whenever I try and use ActionLink ? I've only
I'm getting the following error when I try to use the JSTL XML taglib:
I have this problem when I try to use script/generate: $ script/generate start /Users/gst/.gem/ruby/1.8/gems/hpricot-0.8.1/lib/fast_xs.bundle:
Whenever I try to use the Rails script/generate or script/install command I get this
I'm using imagettftext to generate images from OpenType files. Everything works until I try
When I try to use an ssh command in a shell script, the command
When I try to use curl or file_get_contents to read something like http://example.com/python/json/ from
I am try to use stringWithFormat to set a numerical value on the text

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.