Reputation: 3979
I work on an application "shell" on the plateform "Windows Phone 8". I'm just trying to disable all my user UI controllers when a command is executed. All controllers buttons work well in "disable" mode, but I do not know why, my controller "TextBox" is still active. This is very annoying because the user can still click the input fields durant an operation treatment :'(
Thank a lot guys ;-)
This is my code where i try to disable and enable after my operation is finish:
//.... Get the controller textBox in my class
ttbxInputShell = new RadTextBox() { Text = (ContentPanel.FindName("ttbx_shell") as RadTextBox).Text };
//....
// Disable Ui
#region DisableUI
public void DisableUi()
{
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
ttbxInputShell.IsEnabled = false; //No Work
ttbxInputShell.IsHitTestVisible = false; //No Work
ttbxInputShell.IsReadOnly = true; //No Work
btnLastCommande.IsEnabled = false; //Work
btnHelpCommande.IsEnabled = false; //Work
btnExecuteCommande.IsEnabled = false; //Work
});
}
#endregion
// Enable Ui
#region EnableUI
public void EnableUi()
{
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
ttbxInputShell.IsEnabled = true;
ttbxInputShell.IsHitTestVisible = true;
ttbxInputShell.IsReadOnly = false;
btnLastCommande.IsEnabled = true;
btnHelpCommande.IsEnabled = true;
btnExecuteCommande.IsEnabled = true;
});
}
#endregion
XAML CODE
<TextBox x:Name="ttbx_shell" KeyDown="ttbx_shell_KeyDown_1" GotFocus="ttbx_shell_GotFocus_1" LostFocus="ttbx_shell_LostFocus_1" TextChanged="ttbx_shell_TextChanged_1" HorizontalAlignment="Stretch" VerticalAlignment="Center" TextWrapping="Wrap" Height="100" Margin="-7,-8,0,0" FontSize="26" Padding="3,6,3,0" Grid.Row="2" FontFamily="dos_font.ttf#Perfect DOS VGA 437 Win" />
<Button x:Name="btnLastCommande" Content="F1" Grid.Row="2" Margin="231,0,55,0" Grid.ColumnSpan="3" Tap="btnLastCommande_Tap" />
<Button x:Name="btnHelpCommande" Content="?" Grid.Row="2" Grid.Column="1" Margin="55,0,95,0" Grid.ColumnSpan="3" Tap="btnHelpCommande_Tap"/>
<Button x:Name="btnExecuteCommande" Grid.Row="2" Grid.Column="2" Content="Enter" Padding="-3" Margin="55,0,-5,0" Grid.ColumnSpan="2" Tap="btnExecuteCommande_Tap"/>
</Grid>
And this is a picture of my application, where you can find the input is still enbale .. But the buttons is disable:
Upvotes: 0
Views: 134
Reputation: 7773
You enable / disable a control which is not added to your UI. The original control with the name "ttbx_shell" shown in the UI is thus not affected.
Upvotes: 0