简体   繁体   English

根据WPF C#中的条件控制选项卡按钮按下时的导航

[英]Controlling navigation on tab button press based on conditions in WPF C#

I have few drop downs in my screen and I want to control the navigation from one drop down to another on tab button press if nothing is selected in the drop downs. 我的屏幕上没有几个下拉菜单,并且如果下拉菜单中未选择任何内容,我想控制从一个下拉菜单到另一个按下选项卡按钮的导航。 How I can achieve this.I'm using mvvm pattern wpf application. 我该如何实现呢?我正在使用mvvm模式wpf应用程序。

If I understand correctly, basically you want a combobox to be a tab stop ONLY if there's nothing selected (perhaps to facilitate form filling?). 如果我理解正确,那么基本上,您只希望在没有选择任何内容的情况下使组合框成为制表位(也许有助于表格填充?)。 Would a style like this work? 这样的风格行得通吗?

    <Style TargetType="ComboBox">
        <Setter Property="IsTabStop" Value="False"></Setter>
        <Style.Triggers>
            <Trigger Property="SelectedItem" Value="{x:Null}">
                <Setter Property="IsTabStop" Value="True"/>
            </Trigger>
        </Style.Triggers>
    </Style>

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

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