在使用C#和WPF基于MVVM体系结构构建的应用程序中,我使用RadWindow提示用户使用“确定”和“取消”选项输入文件名。
我希望能够根据用户输入启用/禁用“确定”按钮,或者使之可见/不可见。
例如:输入文件名->确定按钮已启用/可见
文件名为空->确定按钮已禁用/不可见。
我该如何实现这种行为?
TelerikRadPrompt
窗口具有一个Template
包含aTextBox
和2的自定义Buttons
。要Button
基于的输入启用或禁用TextBox
,您可以在OKBinding
的IsEnabled
属性中添加Button
:
<telerik:RadButton x:Name="OK"
Command="{x:Static telerik:WindowCommands.Confirm}"
telerikNavigation:RadWindow.ResponseButton="Accept"
MinWidth="70"
IsTabStop="True"
TabIndex="1"
HorizontalAlignment="Right"
telerik:LocalizationManager.ResourceKey="Ok"
Margin="0 10 8 8"
IsEnabled="{Binding ElementName=PromptTextBox,Path=Text.Length}" />
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句