Xamarin UWP Set PasswordBox Placeholder Color -
i have xamarin.forms shared project login page. uwp use password reveal functionality, why need passwordbox control. set placeholdertext color passwordbox control in uwp. problem xamarin not have passwordboxrenderer , passwordbox control not have property edit placeholder foreground color.
i haven't been able find updated/xamarin solution. or solution appreciated.
the best way override default brush in passwordbox resource, this:
<passwordbox placeholdertext="password"> <passwordbox.resources> <solidcolorbrush x:key="textcontrolplaceholderforegroundfocused" color="red"/> <solidcolorbrush x:key="textcontrolplaceholderforeground" color="red"/> </passwordbox.resources> </passwordbox> you may override: textcontrolplaceholderforegroundpointerover, textcontrolplaceholderforegrounddisabled
add new usercontrol project change to:
<passwordbox x:class="app3.custompasswordbox" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:ignorable="d" width="200" height="50" placeholdertext="placeholder"> <passwordbox.resources> <solidcolorbrush x:key="textcontrolplaceholderforegroundfocused" color="red"/> <solidcolorbrush x:key="textcontrolplaceholderforeground" color="red"/> </passwordbox.resources> </passwordbox> remove custompasswordbox.xaml.cs.
create new renderer:
public class passwordrenderer : viewrenderer<entry, custompasswordbox> { }
Comments
Post a Comment