Silverlight Controls and Silverlight Toolkithttp://forums.silverlight.net//35.aspx/1?Silverlight+Controls+and+Silverlight+ToolkitDiscussions around using and developing Silverlight controls and the Silverlight ToolkitMon, 01 Jan 0001 00:00:00 -050035146033http://forums.silverlight.net//p/57420/146033.aspx/1?PasswordBox+and+text+input+problemsPasswordBox and text input problems <p>Hi,</p> <p>I have a Silverlight app that requires the user to log into the system, therefore I have a TextBox for the username, a PasswordBox for the password (what else ;-)) and a Button to log in.</p> <p>When the user clicks on the Button I set the TextBox's &#43; PasswordBox's IsEnabled property to false and when the login process is done I reset this property to true again.</p> <p>The problem is that when the login doesn't succeed the user would have to reenter his credentials but that's not possible anymore - the cursor blinks inside the PasswordBox but you can't enter any text into it or anything else. It just seems like this control is somewhere overlayed by another control which isn't the case here as it is hosted inside a StackPanel.</p> <p>Any ideas what could be going on here and how to fix it?</p> <p>Thanks,</p> <p>robert.oh.</p> 2008-12-11T12:56:12-05:00148107http://forums.silverlight.net//p/57420/148107.aspx/1?Re+PasswordBox+and+text+input+problemsRe: PasswordBox and text input problems <p>Could you post some of your xaml and code behind? That would help.</p> 2008-12-15T20:19:07-05:00148128http://forums.silverlight.net//p/57420/148128.aspx/1?Re+PasswordBox+and+text+input+problemsRe: PasswordBox and text input problems <p>Good evening,</p> <p>here's the code:</p> <p>&nbsp;<pre class="prettyprint">&lt;<SPAN class=tag>UserControl</SPAN><SPAN class=attr> x:Class=</SPAN><SPAN class=attrv>"LogOnOffControl"</SPAN><SPAN class=attr> xmlns=</SPAN><SPAN class=attrv>"http://schemas.microsoft.com/winfx/2006/xaml/presentation"</SPAN><SPAN class=attr> xmlns:x=</SPAN><SPAN class=attrv>"http://schemas.microsoft.com/winfx/2006/xaml"</SPAN>&gt; &lt;<SPAN class=tag>Grid</SPAN>&gt; &lt;<SPAN class=tag>Grid.ColumnDefinitions</SPAN>&gt; &lt;<SPAN class=tag>ColumnDefinition</SPAN><SPAN class=attr> Width=</SPAN><SPAN class=attrv>"Auto"</SPAN>/&gt; &lt;<SPAN class=tag>ColumnDefinition</SPAN><SPAN class=attr> Width=</SPAN><SPAN class=attrv>"*"</SPAN>/&gt; &lt;<SPAN class=tag>ColumnDefinition</SPAN><SPAN class=attr> Width=</SPAN><SPAN class=attrv>"Auto"</SPAN>/&gt; &lt;/<SPAN class=tag>Grid.ColumnDefinitions</SPAN>&gt; &lt;<SPAN class=tag>TextBlock</SPAN><SPAN class=attr> Text=</SPAN><SPAN class=attrv>"blablabla"</SPAN><SPAN class=attr> FontWeight=</SPAN><SPAN class=attrv>"Bold"</SPAN>/&gt; &lt;<SPAN class=tag>TextBlock</SPAN><SPAN class=attr> x:Name=</SPAN><SPAN class=attrv>"lblErrorMessage"</SPAN><SPAN class=attr> Grid.Column=</SPAN><SPAN class=attrv>"1"</SPAN><SPAN class=attr> Foreground=</SPAN><SPAN class=attrv>"Red"</SPAN><SPAN class=attr> FontWeight=</SPAN><SPAN class=attrv>"Bold"</SPAN><SPAN class=attr> Visibility=</SPAN><SPAN class=attrv>"Collapsed"</SPAN><SPAN class=attr> HorizontalAlignment=</SPAN><SPAN class=attrv>"Right"</SPAN><SPAN class=attr> TextWrapping=</SPAN><SPAN class=attrv>"Wrap"</SPAN>/&gt; &lt;<SPAN class=tag>StackPanel</SPAN><SPAN class=attr> x:Name=</SPAN><SPAN class=attrv>"pnlLogOn"</SPAN><SPAN class=attr> Orientation=</SPAN><SPAN class=attrv>"Horizontal"</SPAN><SPAN class=attr> Grid.Column=</SPAN><SPAN class=attrv>"2"</SPAN>&gt; &lt;<SPAN class=tag>TextBlock</SPAN><SPAN class=attr> Text=</SPAN><SPAN class=attrv>"Benutzername:"</SPAN>/&gt; &lt;<SPAN class=tag>TextBox</SPAN><SPAN class=attr> x:Name=</SPAN><SPAN class=attrv>"txtUserName"</SPAN><SPAN class=attr> Width=</SPAN><SPAN class=attrv>"60"</SPAN><SPAN class=attr> Margin=</SPAN><SPAN class=attrv>"5,0,5,0"</SPAN>/&gt; &lt;<SPAN class=tag>TextBlock</SPAN><SPAN class=attr> Text=</SPAN><SPAN class=attrv>"Passwort:"</SPAN>/&gt; &lt;<SPAN class=tag>PasswordBox</SPAN><SPAN class=attr> x:Name=</SPAN><SPAN class=attrv>"txtPassword"</SPAN><SPAN class=attr> Width=</SPAN><SPAN class=attrv>"60"</SPAN><SPAN class=attr> Margin=</SPAN><SPAN class=attrv>"5,0,5,0"</SPAN>/&gt; &lt;<SPAN class=tag>Button</SPAN><SPAN class=attr> x:Name=</SPAN><SPAN class=attrv>"btnLogOn"</SPAN><SPAN class=attr> Content=</SPAN><SPAN class=attrv>"Anmelden"</SPAN><SPAN class=attr> Click=</SPAN><SPAN class=attrv>"btnLogOn_Click"</SPAN><SPAN class=attr> Margin=</SPAN><SPAN class=attrv>"5,0,5,0"</SPAN>/&gt; &lt;/<SPAN class=tag>StackPanel</SPAN>&gt; &lt;<SPAN class=tag>StackPanel</SPAN><SPAN class=attr> x:Name=</SPAN><SPAN class=attrv>"pnlLogOff"</SPAN><SPAN class=attr> Orientation=</SPAN><SPAN class=attrv>"Horizontal"</SPAN><SPAN class=attr> Visibility=</SPAN><SPAN class=attrv>"Collapsed"</SPAN><SPAN class=attr> Grid.Column=</SPAN><SPAN class=attrv>"2"</SPAN>&gt; &lt;<SPAN class=tag>TextBlock</SPAN><SPAN class=attr> Text=</SPAN><SPAN class=attrv>"Angemeldet als "</SPAN>/&gt; &lt;<SPAN class=tag>TextBlock</SPAN><SPAN class=attr> x:Name=</SPAN><SPAN class=attrv>"lblUserName"</SPAN><SPAN class=attr> Foreground=</SPAN><SPAN class=attrv>"Red"</SPAN><SPAN class=attr> FontWeight=</SPAN><SPAN class=attrv>"Bold"</SPAN><SPAN class=attr> Margin=</SPAN><SPAN class=attrv>"5,0,5,0"</SPAN>/&gt; &lt;<SPAN class=tag>Button</SPAN><SPAN class=attr> x:Name=</SPAN><SPAN class=attrv>"btnLogOff"</SPAN><SPAN class=attr> Content=</SPAN><SPAN class=attrv>"Abmelden"</SPAN><SPAN class=attr> Click=</SPAN><SPAN class=attrv>"btnLogOff_Click"</SPAN><SPAN class=attr> Margin=</SPAN><SPAN class=attrv>"5,0,5,0"</SPAN>/&gt; &lt;/<SPAN class=tag>StackPanel</SPAN>&gt; &lt;/<SPAN class=tag>Grid</SPAN>&gt; &lt;/<SPAN class=tag>UserControl</SPAN>&gt;</pre>&nbsp; <P mce_keep="true">The click on 'btnLogon' calls the method below with a parameter value of 'false' to disable the controls and also calls the async WCF service that verifies the given credentials.</P> <P mce_keep="true">In the 'Completed' part of the async WCF service the method below is called again with a parameter value of 'true'.</P> <P mce_keep="true">&nbsp;<pre class="prettyprint"><SPAN class=kwd>private void</SPAN> SetLogOnComponentents(<SPAN class=kwd>bool</SPAN> enableControls) { <SPAN class=kwd>this</SPAN>.txtPassword.IsEnabled = <SPAN class=kwd>this</SPAN>.txtUserName.IsEnabled = <SPAN class=kwd>this</SPAN>.btnLogOn.IsEnabled = enableControls; }</pre>&nbsp; </p> <p>Hope this helps.</p> <p>Thanks for advice!</p> 2008-12-15T20:40:38-05:00148139http://forums.silverlight.net//p/57420/148139.aspx/1?Re+Re+PasswordBox+and+text+input+problemsRe: Re: PasswordBox and text input problems <p>Some of the XAML code is cut off. When the WCF fails, do you have it calling the SetLogOn function?</p> 2008-12-15T21:19:23-05:00148358http://forums.silverlight.net//p/57420/148358.aspx/1?Re+Re+PasswordBox+and+text+input+problemsRe: Re: PasswordBox and text input problems <p>Good morning,</p> <p>I can't see cut off XAML code.</p> <p>But yes, if the service fails I'm also calling the method that enables the controls again.</p> <p>Thanks,</p> <p>robert.oh.</p> 2008-12-16T05:57:59-05:00182118http://forums.silverlight.net//p/57420/182118.aspx/1?Re+Re+PasswordBox+and+text+input+problemsRe: Re: PasswordBox and text input problems <p>Is there anybody who's found a workaround ? I have the same problem, and i have not finded a better practice than add a panel over textbox.</p> 2009-03-03T12:26:08-05:00