尝试关闭动态创建的MetroTabItem时出现运行时异常 [英] Runtime Exception while trying to close dynamically created MetroTabItem

查看:62
本文介绍了尝试关闭动态创建的MetroTabItem时出现运行时异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在我的wpf应用程序中使用MahApps.Metro控件。

我在按钮点击时将MetroTabItem添加到MetroTab控件。

>尝试关闭MetroTabItem时出现异常。



异常消息:由于对象的当前状态,操作无效。



使用以下代码在运行时添加TabItem。



Hi,
I am using MahApps.Metro controls in my wpf app.
I am adding MetroTabItem to MetroTab control on button click.
> getting exception while trying to close MetroTabItem .

Exception Msg: Operation is not valid due to the current state of the object.

using the following code to add TabItem at runtime.

MetroTabItem tbItem = new MetroTabItem();
tbItem.Header = "RunTime";
tbItem.CloseButtonEnabled = true;
TextExamples cnt = new TextExamples();
tbItem.Content = cnt;
MainTabctrl.Items.Add(tbItem);





在公共Window()上创建的MetroTabItems(即表单加载),上面给出的代码没有显示任何问题。



请帮我解决问题。

提前谢谢..



The MetroTabItems created on public Window() (i.e form loading), not showing any problem with the same code given above.

please help me to solve the issue.
Thanks in advance..

推荐答案

我在这里获得了解决方案。 />


问候

Sameer
I got solution here .

Regards
Sameer


这篇关于尝试关闭动态创建的MetroTabItem时出现运行时异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆