Display Metadata as label

4 posts, 0 answers
  1. Trevor
    Trevor avatar
    13 posts
    Member since:
    Jun 2011

    Posted 19 Sep 2011 Link to this post

    have a domain data source that I have annotated with some metadata and displays fine if I bind a dataform to it. But the results aren't what I want. What I want to accomplish is to have certain fields and display them with a label with the metadata instead of writing out what each field is. I don't want to add the AutoGenerateField:=False to most all of them either. Is this possible using a combination of a label and textbox or individually adding datafield controls to a dataform?  This is all going to be ready only too.

    Something Like this:
    <sdk:Label Target="{Binding ElementName=CLText}"/>
     <TextBox Text="{Binding Claim}"  Name="CLText"/>


    And here's a sample of my metadata
             <Display(Name:="Claim Number ")>
           Public Property Claim As String
            
           <DisplayName("City State Zip")>
           Public Property CSZ As String
     
           <Display(Name:="Customer Primary Address")>
           Public Property CustAddy1 As String
  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2477 posts

    Posted 21 Sep 2011 Link to this post

    Hello Trevor,

    Unfortunately, we could not understand which of Telerik's controls are you using.

    Could you please elaborate how is this question related to our controls? We would be glad to answer any questions that are particularly related to the controls that we offer.

    Best wishes,
    Ross
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. Trevor
    Trevor avatar
    13 posts
    Member since:
    Jun 2011

    Posted 21 Sep 2011 Link to this post

        Well I asked my question if it was possible without specifically using a telerik control. But I also attempted it this way using the raddataform. This correctly displays the data, but does not display labels.

    I just pasted text as I keep getting an XML error trying to use the 'Format Code Block'

    <DataTemplate x:Key="MyTemplate">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <telerik:DataFormDataField DataMemberBinding="{Binding CSZ}"/>
                    <telerik:DataFormDataField Grid.Column="1" DataMemberBinding="{Binding Claim}" />
                    </Grid>
            </DataTemplate>
       
    <telerik:RadDataForm  ItemsSource="{Binding ElementName=ProjectData,Path=Data}" CurrentItem="{Binding}"  AutoGenerateFields="False" ReadOnlyTemplate="{StaticResource MyTemplate}"/>



                

  4. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 26 Sep 2011 Link to this post

    Hi Trevor,

    In the context of RadDataForm - in short - if you leave it to create the fields for you , it will respect the data annotation attributes. If you specify your own fields in XAML and set AutoGenerateFields to false, the responsibility of setting the label text would be yours.

    All the best,
    Pavel Pavlov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top