i made a custom skinned textbox in App.xaml, here's the XAML:
this gives all the textbox's same theme, i declare it in a Window like this:
Now the problem is, i dont see the blinking cursor in textbox, nor can i type/backspace/paste/copy anything in it, i subscribed to the KeyDown event to see if it is detecting key presses, it does but it for some reason not showing the text nor the cursor, also note that if i do not include the " <Setter Property="Templ ate">" and its childs, the textbox works fine, but then it is not completely skinned... any clues?
Code:
<Style TargetType="{x:Type TextBox}">
<Setter Property ="Background">
<Setter.Value>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox">
<GradientStop Color="#FFF8F8F8" Offset="0.116"/>
<GradientStop Color="#FFE8E8E8" Offset="0.672"/>
<GradientStop Color="#FFF0F0F0" Offset="0.388"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="BorderBrush">
<Setter.Value>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFD0D0D0" Offset="0.073"/>
<GradientStop Color="White" Offset="1"/>
<GradientStop Color="#FED4D4D4" Offset="0.366"/>
<GradientStop Color="#FED6D6D6" Offset="0.724"/>
<GradientStop Color="#FED0D0D0" Offset="0.108"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}">
<Border BorderThickness="1" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}"/>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderBrush">
<Setter.Value>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFA7A7A7" Offset="1"/>
<GradientStop Color="#FFD0D0D0"/>
<GradientStop Color="DarkGray" Offset="0.44"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsFocused" Value="True">
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox">
<GradientStop Color="#FFF8F8F8"/>
<GradientStop Color="#FFF0F0F0" Offset="0.672"/>
<GradientStop Color="#FFF0F0F0" Offset="0.401"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="BorderBrush">
<Setter.Value>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFD0D0D0" Offset="0.073"/>
<GradientStop Color="#FED0D0D0" Offset="0.909"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect BlurRadius="48" Opacity="0.295" ShadowDepth="3" Color="#FF939393" Direction="191"/>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#4CECECEC" Offset="0"/>
<GradientStop Color="#FFD4D4D4" Offset="1"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="Foreground" Value ="#FF7A7A7A"/>
<Setter Property="Effect">
<Setter.Value>
<BlurEffect Radius="2" RenderingBias="Quality"/>
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Code:
<TextBox Height="23" HorizontalAlignment="Left" Margin="106,175,0,0" Name="textBox1" VerticalAlignment="Top" Width="201" KeyDown="textBox1_KeyDown" />
Now the problem is, i dont see the blinking cursor in textbox, nor can i type/backspace/paste/copy anything in it, i subscribed to the KeyDown event to see if it is detecting key presses, it does but it for some reason not showing the text nor the cursor, also note that if i do not include the " <Setter Property="Templ ate">" and its childs, the textbox works fine, but then it is not completely skinned... any clues?
Comment