Skip to main content
Microsoft Silverlight
Home Forums Silverlight Programming Programming with .NET - General DataFormFiled's FieldLabelContent problem
1 replies. Latest Post by Mog Liang - MSFT on May 4, 2009.
(0)
Enrai
Member
1 points
2 Posts
04-27-2009 11:29 AM |
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 Lian...
All-Star
16550 points
1,595 Posts
05-04-2009 3:17 AM |
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>