This is a migrated thread and some comments may be shown as answers.

Label showing invalid DisplayAttribute value

3 Answers 68 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sandhiya
Top achievements
Rank 1
Sandhiya asked on 23 Aug 2013, 07:11 PM
I was trying latest trial (version 2013.2.724.1050)
And I include implicit windows8 themes (System.Windows.xaml) in the project.
Then somehow some labels showing invalid value for DisplayAttribute, please see attached picture.

Below is my xaml:
xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"

<
sdk:Label Grid.Row="0" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" Target="{Binding ElementName=txtCode}" />
<TextBox x:Name="txtCode" Grid.Row="0" Grid.Column="2" Width="150" MaxLength="25" HorizontalAlignment="Left" IsReadOnly="True" Text="{Binding PurchaseOrder.Code}" />
 
<sdk:Label Grid.Row="2" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center" Target="{Binding ElementName=txtDate}" />
<TextBox x:Name="txtDate" Grid.Row="2" Grid.Column="2" Width="150" MaxLength="25" HorizontalAlignment="Left" IsReadOnly="True" Text="{Binding PurchaseOrder.Date}" />

My business model:
[Display(Name = "labelCode", ResourceType = typeof(Captions))]
public string Code
{
    get
    {
        return _code;
    }
    set
    {
        _code = value;
        RaisePropertyChanged("Code");
    }
}
private string _code;
 
[Display(Name = "labelDate", ResourceType = typeof(Captions))]
public DateTime? Date
{
    get
    {
        return _date;
    }
    set
    {
        _date = value;
        RaisePropertyChanged("Date");
    }
}
private DateTime? _date;

I need to comment out below entries in System.Windows.xaml (included in Windows8 implicit themes):
<!-- System.Windows.TextBox-->
<Style x:Key="TextBoxStyle" TargetType="TextBox">
    <Setter Property="BorderBrush" Value="{telerik:Windows8Resource ResourceKey=BasicBrush}" />
    <Setter Property="Background" Value="{telerik:Windows8Resource ResourceKey=MainBrush}" />
    <Setter Property="Foreground" Value="{telerik:Windows8Resource ResourceKey=MarkerBrush}" />
 
    <!-- THESE 2 LINES MAKES DisplayAttributeValue BECOMES INVALID
    <Setter Property="FontFamily" Value="{telerik:Windows8Resource ResourceKey=FontFamilyStrong}" />
    <Setter Property="FontSize" Value="{telerik:Windows8Resource ResourceKey=FontSize}" />
    -->
 
    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
    <Setter Property="VerticalContentAlignment" Value="Center" />
    <Setter Property="Padding" Value="5 2" />
    <Setter Property="BorderThickness" Value="1" />

After that, DisplayAttribute will work fine.
Any clue on this?






3 Answers, 1 is accepted

Sort by
0
Sandhiya
Top achievements
Rank 1
answered on 27 Aug 2013, 06:27 PM
Hi guys, any comment on this?
I have created a sample project to regenerate the behavior.
You can download it on here.

0
Pana
Telerik team
answered on 28 Aug 2013, 02:56 PM
Hi,

This:
{telerik:Windows8Resource ResourceKey=FontFamilyStrong}
Is a binding. And it is bound to FontFamilyStrong. It appears that the Label displays the target property of this binding instead of the binding in the Text of the TextBox. Although it is very inconvenient I can not think of a reasonable fix nor commit to a deadline for such. I can only ask you to set the Content of the Label for now.

Regards,
Pana
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Sandhiya
Top achievements
Rank 1
answered on 28 Aug 2013, 04:35 PM
Hi Pana, thanks for your reply.
For now, I set the FontFamily & FontSize Properties manually in Windows8 implicit themes.
However by doing this, I won't be able to change those properties at runtime.
Tags
General Discussions
Asked by
Sandhiya
Top achievements
Rank 1
Answers by
Sandhiya
Top achievements
Rank 1
Pana
Telerik team
Share this question
or