Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

New Post: Image/watermark disappear in WatermarkTextBox

$
0
0
Hi,

Q1 : I run your snippet ant I see perfectly the image along with the watermark. Is the image included in the sln ? Is the path correct ?

Q2 : If you want to keep the image at all time, you should use a ContentControl with a ContentTemplate including a WatermarkTextBox. Something like :
<Window.Resources>
      <DataTemplate x:Key="ContentDataTemplate">
          <StackPanel Orientation="Horizontal" >
            <Image Source="pack://application:,,,/WpfApplication42;component/Images/User16.png" Height="16" Width="16" Stretch="Fill" />
            <xctk:WatermarkTextBox Margin="4,0,0,0" 
                                                Text="{Binding .}" 
                                                Watermark="UserName" 
                                                Width="200" Height="25"/>
         </StackPanel>
      </DataTemplate>   
   </Window.Resources>
    
   <Grid>
         <ContentControl Content="{Binding Username}"
                                   ContentTemplate="{StaticResource ContentDataTemplate}"/>
   </Grid>
Q3 : Right now, the design is to show the watermark when the watermarkTextBox doesn't have the focus and the Text is empty. As soon as 1 of the 2 conditions is not respected, the watermark disappears.

Viewing all articles
Browse latest Browse all 4964

Trending Articles