Update source with TemplateBinding

Posted by Polaris on Stack Overflow See other posts from Stack Overflow or by Polaris
Published on 2010-05-12T10:46:01Z Indexed on 2010/05/13 8:24 UTC
Read the original article Hit count: 273

Filed under:
|
|

I use this style for all my labels

    <Style TargetType="Label" x:Key="LabelStyle">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Label">
                    <StackPanel Orientation="Horizontal"  >
                        <TextBox Loaded="MyTextBlock_Loaded" x:Name="EditControl" Visibility="Collapsed" Text="{TemplateBinding Tag}" />
                        <Label Content="{TemplateBinding Content}" Grid.Column="1" Grid.Row="1">
                        </Label>
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

and my sample label

<Label Grid.Column="0" Grid.Row="0" Content="Photo" Style="{StaticResource LabelStyle}" Tag="{Binding fieldsCode.firstName, UpdateSourceTrigger=PropertyChanged}"/>

But I feel that TemplateBiding doesn't support update of property. How can solve this issue

© Stack Overflow or respective owner

Related posts about wpf

Related posts about databinding