Not able to set Custom UI Elements as Cell Content:Existing Feature has be Suppressed in Q12010 for RadGridView?

7 posts, 0 answers
  1. Dominic Savio maria selvaraj
    Dominic Savio maria selvaraj avatar
    16 posts
    Member since:
    Mar 2010

    Posted 31 Mar 2010 Link to this post

    Hi,

    i was using Q3 2009 and i populate my RadGridView  with a Datatable of Dynamically generated classes.

    I used to have one of the Datatable columns with Type "object" which contains a stackpanel with image +Text data and the RadGridView was displaying it fine.
    But after i have updated to Q1 2010 the RadGridView just displays the Type Text,

    • Code Used:

      StackPanel contentPanel = new StackPanel() { Orientation = Orientation.Horizontal };

       

       

    TextBlock contentText = new TextBlock() { TextAlignment = TextAlignment.Center, Text = "Video"};

     

     

    Image contentImage = new Image() { VerticalAlignment = VerticalAlignment.Top, Height = 20, Width = 20 };

     

    contentImage.Source =

    new BitmapImage(new Uri(@"Images/video.png", UriKind.Relative));

     

    contentPanel.Children.Add(contentImage);

    contentPanel.Children.Add(contentText);


    datatable.Columns.Add(

    new DataColumn() { ColumnName = xmlFields.Name.LocalName, DataType = typeof(object) });

     

    datarow[xmlFields.Name.LocalName]=contentPanel;
    this
    .radGridView.ItemsSource = datatable;

     

     

     

    All i want is to set the cell content as Image+Text,
    Is there a other way to set Customized (Image+Text)Cell content when the columns that are dynamically created?

    i have attached a screen shot which explains better..

    Kindly do the needful.

    Thanks and Regards
    Dominic savio.M

  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 31 Mar 2010 Link to this post

    Hi,

    Please add desired UI elements and/or templates to the grid instead DataTable! You can use CellTemplate and/or CreateCellElement in inherited column to achieve this.

    Sincerely yours,
    Vlad
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. DevCraft banner
  4. Dominic Savio maria selvaraj
    Dominic Savio maria selvaraj avatar
    16 posts
    Member since:
    Mar 2010

    Posted 31 Mar 2010 Link to this post

    Hi Vlad,

    But it was working with Q3 2009 , do i have to change the logics for every version Updates..!
    any way,

    could you please give an simple example  regarding how to set a cell template programatically(not in Xaml),
    because i dosent have Columns created in xaml , they are created at run time.


    Thank you
    Dominic savio.M
  5. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 31 Mar 2010 Link to this post

    Hi,

    You don't have to change your logic for common things however UI as a part of your data layer is a bit unusual - in my opinion this was supported incidentally.

    You can assign CellTemplate in exactly the same way as in XAML:

    column.CellTemlate = (DataTemplate)this.Resource["YourTemplate"];

    If you want to instantiate DataTemplate programmatically you can use XamlReader.Load(). The other option will be (as I said in my previous reply) to inherit from desired column, override CreateCellElement and return desired FrameworkElement.

    All the best,
    Vlad
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  6. Dominic Savio maria selvaraj
    Dominic Savio maria selvaraj avatar
    16 posts
    Member since:
    Mar 2010

    Posted 31 Mar 2010 Link to this post

    Thanks Vlad,

    am working on the Cell template, i do have one more issue regarding setting background of theTop left Header Cell above the indicator ,i have posted it twice still havent got any reply..
    could you please help me with that..

    Thanks and regards
    Dominic savio.M
  7. Dominic Savio maria selvaraj
    Dominic Savio maria selvaraj avatar
    16 posts
    Member since:
    Mar 2010

    Posted 31 Mar 2010 Link to this post

    Hi,

    i have identified the problem with setting background to TopLeftHeaderCell,

    when i have a theme applied to the Application the GridViewHeaderRowStyle is not getting applied.

    Example:

    when i have 

     

    StyleManager.ApplicationTheme = ThemeManager.FromName("Vista");

     

     

    the below code is not effective

     

     

    <Style x:Key="GridViewHeaderRowStyle" TargetType="gridView:GridViewHeaderRow">

     

     

     

    <Setter Property="Background" Value="Red" />

     

     

     

    </Style>

    how can i fix this?

     

     

     

  8. Kalin Milanov
    Admin
    Kalin Milanov avatar
    447 posts

    Posted 05 Apr 2010 Link to this post

    Hello Dominic Savio maria selvaraj,

    I believe this was covered in another forum post of yours. In any case please review this post which illustrates how to go about restyling the header and let me know if you need any additional assistance.

    Please lets keep this conversation in only one forum thread.

    Greetings,

    Kalin Milanov
    the Telerik team

     


    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top
DevCraft banner