开发者

UserControls, TabControl, Window confusion

I have a number of usercontrols inside tabitems in a tabcontrol in a main Window. One user control per tabitem all inside a window.

After some code executes inside one of the controls (inside one of the tabi开发者_运维知识库tems), I want to enable/disable other tabitems.

How can I do it?


Normally you would do logic in the Model object, so the event that you have 'executing' would alter the Model (via method call), then the Model would update it's internal state, which would be reflected by DependencyProperties, which you would bind your UI via Xaml.


You can modify the enabled and visible properties:

tabPage1.Enabled = false;
tabPage1.Visible = false;

Think this fits the OP more:

FrameworkElement parent = userControl.Parent as FrameworkElement; // As is not needed, 'userControl' could be 'this'

if (FrameworkElement != null)
{
    parent.IsEnabled = false;
    parent.IsVisible = false;
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜