尝试关闭动态创建的MetroTabItem时出现运行时异常

编程入门 行业动态 更新时间:2024-10-27 09:38:31
本文介绍了尝试关闭动态创建的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时出现运行时异常

本文发布于:2023-11-11 16:57:09,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1579030.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:异常   动态   MetroTabItem

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!