DataFormDataField Label Width

2 posts, 0 answers
  1. Alex
    Alex avatar
    6 posts
    Member since:
    Jun 2011

    Posted 18 Jul 2012 Link to this post

    Hi,  Is there a way to set the DataFormDataField so that the TextBox has a MaxWidth, and the Label width stretches to cover the rest of the width of the DataField?

    I'm trying to create a form where the responses will all be numeric (so the TextBox doesn't need to stretch to Infinity), but the length of the label varies wildly (ergo, does need to stretch).  The labels on my DataFormDataFields are being cut off to allow the TextBox (plus spacing) to have more room.  If I increase the width of the DataField, this increases the amount of space between the TextBox and the Label. 

    I've played with the Width of the DataField, the Min, Max & Width of the DataField.Label, the Width of TextBoxes, all to no joy.  Similar results messing with HorizontalAlignment, HorizontalContentAlignment, and even ZIndex (I thought I could bring the label above the text box).

    Thanks for any ideas, I'm at the stage where I'm about to start coding a Label + TextBox in a Stackpanel solution for each of my datafields, and I'd _really_ prefer not to.  

    Also (coz I think it's relevant but I'm not sure), I don't have Expression Blend.



  2. Dimitrina
    Dimitrina avatar
    3769 posts

    Posted 18 Jul 2012 Link to this post

    Hello Alex,

     In case you cannot edit the Template of the DataFormDataField using Blend, you could find it available within the Themes folder shipped with the RadControls for WPF. It is located in the "Telerik.Windows.Controls.Data.xaml" file and it is named "DataFormDataFieldTemplate".

    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top