<Style TargetType="TextBox">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Grid>
<Border BorderBrush="Red" CornerRadius="2" />
<ScrollViewer x:Name="PART_ContentHost" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<Label x:Name="watermarklabel" Height="40" Content="{TemplateBinding Tag}" Foreground="Gray"/>
</Grid>
<ControlTemplate.Triggers>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Value="True">
<Condition.Binding>
<MultiBinding Converter="{StaticResource Multi}">
<!--<Binding Path="Text" ElementName="txt1"/>-->
<Binding RelativeSource="{RelativeSource Mode=TemplatedParent}" Path="Text"/>
</MultiBinding>
</Condition.Binding>
</Condition>
</MultiDataTrigger.Conditions>
<Setter Property="Visibility" TargetName="watermarklabel" Value="Collapsed"/>
</MultiDataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Here i want to enable/disable the label (which is water mark) upon the condition when the textbox text is empty and not empty. In the multi binding i am trying to access the text property using the TemplatedParent. But it is not hitting convertor when text changed.
When i use the element name to access it everything is fine.
But i want to make generic this one..
How to make this to work?
Thanks in advance..