Windows phone 7 绑定类属性

Windows phone 7 绑定类属性,windows-phone-7,Windows Phone 7,我想绑定我的一个类属性。我使用FileList.DataContext=fileManager 下面我把代码放在后面 C# 您不需要从ListBoxItem继承类,因为您使用的是ItemTemplate 使用简单类并将其绑定到列表 public class File { private string name; public string Name { get { return this.name; }

我想绑定我的一个类属性。我使用
FileList.DataContext=fileManager
下面我把代码放在后面

C#


您不需要从ListBoxItem继承类,因为您使用的是ItemTemplate

使用简单类并将其绑定到列表

public class File 
    {
        private string name;
        public string Name
        {
            get { return this.name; }
            set { this.name = value; }
        }
        private string id;
        public string Id
        {
            get { return this.id; }
            set { this.id = value; }
        }
    }

你有什么例外?这是最奇怪的。没有异常,只有代码在我的问题更新中添加的结束代码处像断点一样停止(但不是我的)。在
应用程序中没有异常吗?
FileList\u Tap
处理程序是否已实现?什么是
stringConv
转换器?请定位实际问题并尽可能显示少量代码
<ListBox Name="FileList" Width="auto" Height="578" ItemsSource="{Binding Files, Mode=OneWay}" Tap="FileList_Tap" FontSize="36" Margin="0,14,0,15">
          <ListBox.ItemTemplate>
            <DataTemplate>
              <TextBlock Text="{Binding Name}"/>
            </DataTemplate>
          </ListBox.ItemTemplate>
</ListBox>
// Code to execute on Unhandled Exceptions
        private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
        {
            if (System.Diagnostics.Debugger.IsAttached)
            {
                // An unhandled exception has occurred; break into the debugger
                System.Diagnostics.Debugger.Break();
            }
        }//here debugger stops.
public class File 
    {
        private string name;
        public string Name
        {
            get { return this.name; }
            set { this.name = value; }
        }
        private string id;
        public string Id
        {
            get { return this.id; }
            set { this.id = value; }
        }
    }