selectionchanging

Is there a way to cancel TabControl.Items.CurrentChanging?

空扰寡人 提交于 2019-12-01 18:19:17
There is unfortunately no TabControl.SelectionChanging event (Selector.SelectionChanging), I am struggling to implement this behavior so I can cancel the changing request. I tried to handle the TabControl.Items.CurrentChanging (the Items property is and ItemCollection ) event setting e.Cancel (of the CurrentChangingEventArgs ) to true, but the UI is is updated with the new tab although the item is not changed in the collection. Is there any way to prevent user from switching to a different TabItem when a condition is dissatisfied? ThomasAndersson I don't know the exact reason why this happens,

Is there a way to cancel TabControl.Items.CurrentChanging?

邮差的信 提交于 2019-12-01 17:54:08
问题 There is unfortunately no TabControl.SelectionChanging event (Selector.SelectionChanging), I am struggling to implement this behavior so I can cancel the changing request. I tried to handle the TabControl.Items.CurrentChanging (the Items property is and ItemCollection ) event setting e.Cancel (of the CurrentChangingEventArgs ) to true, but the UI is is updated with the new tab although the item is not changed in the collection. Is there any way to prevent user from switching to a different