输入ISPassword和IsReadonly
我想创建一个详细信息,该详细信息显示了不可编辑的信息,其中某些值像密码条目一样被隐藏/掩盖了“ *****”。我希望用户能够切换一个允许他们看到值的按钮。我尝试使用具有与ISPassword具有绑定的输入控件,其中ISreadonly设置为true如下:
<HorizontalStackLayout>
<Entry Text="{Binding SomeValue}"
IsPassword="{Binding ShowValue}"
IsReadOnly="True"/>
<ImageButton Source="visibility.svg"
Padding="20,0,0,0"
Command="{Binding ToggleValueCommand}"/>
</HorizontalStackLayout>
但是,即使ISPassword为true,iSreadonly设置为true true,即使
这是正确的行为? 如果我无法将isReadonly =“ true”的条目使用,那么拥有标签具有此功能的最佳方法是什么。我应该使用ValueConverter还是行为?
I want to create a DetailsPage that shows non-editable information where some values are hidden/masked like a password entry with "*****". I would like the user to be able to toggle a button that allows them to see the value. I tried using an Entry control that has a binding to IsPassword with IsReadOnly set to true as follows:
<HorizontalStackLayout>
<Entry Text="{Binding SomeValue}"
IsPassword="{Binding ShowValue}"
IsReadOnly="True"/>
<ImageButton Source="visibility.svg"
Padding="20,0,0,0"
Command="{Binding ToggleValueCommand}"/>
</HorizontalStackLayout>
However, when IsReadOnly is set to true the entry shows the text value even when IsPassword is True
Is this the proper behavior?
If I cannot use an Entry with IsReadOnly="True", then what is the best way to have a Label have this functionality. Should I use a ValueConverter or a Behavior?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
作为解决方法,您可以用
输入
用标签
替换,每次单击按钮时更改值。示例代码
XAML
代码背后
As a workaround , you can replace
Entry
with aLabel
, change the value while clicking the button each time .Sample code
Xaml
code behind