Label showing invalid DisplayAttribute value

4 posts, 0 answers
  1. Sandhiya
    Sandhiya avatar
    13 posts
    Member since:
    Jul 2013

    Posted 23 Aug 2013 Link to this post

    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?






  2. Sandhiya
    Sandhiya avatar
    13 posts
    Member since:
    Jul 2013

    Posted 27 Aug 2013 Link to this post

    Hi guys, any comment on this?
    I have created a sample project to regenerate the behavior.
    You can download it on here.

  3. DevCraft banner
  4. Pana
    Admin
    Pana avatar
    748 posts

    Posted 28 Aug 2013 Link to this post

    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 >>
  5. Sandhiya
    Sandhiya avatar
    13 posts
    Member since:
    Jul 2013

    Posted 28 Aug 2013 Link to this post

    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.
Back to Top