Problem with TextBox focus and background
I am trying to make a dialog box to enter a string. But my TextBox does not respond to the mouse and keyboard in any way. In addition, it has a strange background that I can't change. Although in Microsoft Blend xaml it displays normally and responds to the keyboard. What am I doing wrong?
XAML:
Result:
XAML:
Code: Select all
<Page 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:local="clr-namespace:MetroGameUI"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:noesis="clr-namespace:NoesisGUIExtensions;assembly=Noesis.GUI.Extensions"
Title="StartWindow" Width="Auto" Height="Auto" d:DesignHeight="1080" d:DesignWidth="1920" Focusable="True" mc:Ignorable="d">
<Viewbox x:Name="ViewBox" RenderTransformOrigin="0.5,0.5">
<Grid>
<Grid x:Name="Grid_ProfileName" Width="600" Height="260" Margin="660,410" HorizontalAlignment="Center" VerticalAlignment="Center" Background="#CC000000">
<Grid.Effect>
<DropShadowEffect BlurRadius="100" ShadowDepth="40" />
</Grid.Effect>
<Button x:Name="OkBtn" Width="60" Height="60" Margin="200,130,340,10" Content="Button" RenderTransformOrigin="0.478,1.125"
Style="{DynamicResource OkButton}" />
<Button x:Name="CancelBtn" Width="60" Height="60" Margin="340,130,200,10" Content="Button"
Style="{DynamicResource CancelBtn}" />
<TextBox x:Name="TextBox_NameProfile" Width="500" Height="80" Margin="50,40,50,120" Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Background="White"
BorderBrush="{x:Null}"
BorderThickness="0" FontFamily="/MetroGameUI;component/Fonts/#Play" FontSize="36" Text="Profile Name" TextWrapping="Wrap">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseEnter">
<noesis:SetFocusAction/>
</i:EventTrigger>
<i:EventTrigger EventName="GotKeyboardFocus">
<noesis:SelectAllAction/>
</i:EventTrigger>
</i:Interaction.Triggers>
</TextBox>
</Grid>
</Grid>
</Viewbox>
</Page>
Re: Problem with TextBox focus and background
The pink color indicates that there is no style defined for that control. More information at the following thread. You can use our default theme as a starting point, it contains styles for all elements.
Who is online
Users browsing this forum: Ahrefs [Bot] and 13 guests