WPF窗口将数组插入DataGrid

时间:2017-07-14 13:12:33

标签: wpf

C#中的WPF窗口没有立即将内容插入DataGrid的选项,就像WinForms Form

一样
<div class="atwho-view" id="at-view-64" style="display: none; top: 
    135px; left: 440px;">
    <ul class="atwho-view-ul">
        <li class="mention__item cur">
            <p class="mention__notice">
                <span>@Group</span>
                "Notify everyone in this Group."
            </p>    
        </li>
    </ul>
</div>

此代码的替代方法是什么? 那么如何在WPF窗口中将数组插入DataGridView?

2 个答案:

答案 0 :(得分:1)

您实际上可以直接将对象添加到.mobile-only { display: none; } @media only screen and (max-width: 767px){ .mobile-only { display: block; } } 的<{1}}属性:

Items

但是如果您希望能够编辑项目,则应将DataGrid属性设置或绑定到dataGrid.Items.Add(whatever);

ItemsSource

答案 1 :(得分:0)

您需要将DataGrid绑定到ObservableCollection。如果您插入ObservableCollection,它将出现在UI