Skip to main content

Answered Question DataFormFiled's FieldLabelContent problemRSS Feed

(0)

Enrai
Enrai

Member

Member

1 points

2 Posts

DataFormFiled's FieldLabelContent problem

When I try to bind the FieldLabelContent property of a DataForm's Field, I get the following error: AG_E_PARSER_BAD_PROPERTY_VALUE. Does this mean that I can't bind this property of the FieldControls?

The reason I want to bind this property is that I have the values of my FieldLabel's in a resource file.

Thanks in advance for the help! :)

Mog Liang - MSFT
Mog Lian...

All-Star

All-Star

16550 points

1,595 Posts

Answered Question

Re: DataFormFiled's FieldLabelContent problem

If you want to change the FieldLabel's appearance, FieldLabelStyle is the right property.

the default label style is

ctl="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.DataForm"

    <!--FieldLabel-->
    <Style TargetType="ctl:FieldLabel">
        <Setter Property="IsTabStop" Value="False"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ctl:FieldLabel">
                    <StackPanel Orientation="Horizontal">
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualState x:Name="Normal"/>
                                <vsm:VisualState x:Name="Disabled"/>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="ValidationStates">
                                <vsm:VisualState x:Name="ValidFocused"/>
                                <vsm:VisualState x:Name="ValidUnfocused"/>
                                <vsm:VisualState x:Name="InvalidFocused">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentContentControl" Storyboard.TargetProperty="Foreground" Duration="0:0:1.5">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <SolidColorBrush Color="Red" />
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="RequiredStates">
                                <vsm:VisualState x:Name="NotRequired"/>
                                <vsm:VisualState x:Name="Required">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentContentControl" Storyboard.TargetProperty="FontWeight" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="SemiBold"/>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>
                        <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}" CornerRadius="2">
                            <ContentControl x:Name="ContentContentControl" Foreground="{TemplateBinding Foreground}" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" FontWeight="{TemplateBinding FontWeight}" Cursor="{TemplateBinding Cursor}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" FontFamily="{TemplateBinding FontFamily}" FontSize="{TemplateBinding FontSize}" FontStretch="{TemplateBinding FontStretch}" VerticalAlignment="{TemplateBinding VerticalAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" IsTabStop="False" />
                        </Border>
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

Mog Liang
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • Unanswered Question
  • Answered Question
  • Announcement