简体   繁体   English

WPF DataGrid动态列消失

[英]WPF datagrid dynamic columns disappear

I am building a simple 2 tab C# WPF application. 我正在构建一个简单的2选项卡C#WPF应用程序。 On first tab I have Datagrid and Checkbox. 在第一个标签上,我有Datagrid和Checkbox。 Datagrids itemsource is bound to ViewModel ObservableCollection. Datagrids itemsource绑定到ViewModel ObservableCollection。 On checkbox check I am adding to datagrid dynamically one column. 在复选框上,我将动态添加到datagrid的一列。 Till now everything works fine, however when I switch between two tabs the dynamically created column disappearing while the checkbox still remains checked. 到现在为止一切正常,但是当我在两个选项卡之间切换时,动态创建的列消失了,而复选框仍处于选中状态。 Any idea where to look? 知道在哪里看吗? thx 谢谢

Does your second tab have a datagrid as a component? 您的第二个选项卡是否具有数据网格作为组件? It might just well be that you have a tab that is binding to an unknown data source. 您可能有一个绑定到未知数据源的选项卡。 However without code, it's very hard to tell. 但是,如果没有代码,很难说出来。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM