开发者

How do I bind an Entity Object to WPF TextBox?

开发者 https://www.devze.com 2023-01-11 21:45 出处:网络
I feel like I\'m missing something very obvious here but I can\'t get basic binding to work with objects from my EDM.

I feel like I'm missing something very obvious here but I can't get basic binding to work with objects from my EDM.

Here's my xaml:

    <TextBox Text="{Binding Path=receipt.STATUS}"  Height="23" HorizontalAlignment="Left" Margin="371,276,0,0" VerticalAlignment="Top" Width="120" />

Here's my View code-behind:

public MainWindow()
{
    InitializeComponent();
    _vw = new SimpleViewModel();
    DataContext = _vw;
}

Here's my ViewModel:

class SimpleViewModel
{
    private MyEntities _context;
    public RECEIPT receipt;
    ...
    public void GetReceipt(receiptKey)
    {
        IQueryable<RECEIPT> r = from it in _context.RECE开发者_如何学JAVAIPTs
                                      where it.RECEIPTKEY == receiptKey
                                      select it;
        receipt = r.First();
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消