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

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

6 Answers 27 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
Dominic Savio maria selvaraj
Top achievements
Rank 1
Dominic Savio maria selvaraj asked on 31 Mar 2010, 07:46 AM
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

6 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 31 Mar 2010, 07:52 AM
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.
0
Dominic Savio maria selvaraj
Top achievements
Rank 1
answered on 31 Mar 2010, 08:03 AM
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
0
Vlad
Telerik team
answered on 31 Mar 2010, 09:18 AM
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.
0
Dominic Savio maria selvaraj
Top achievements
Rank 1
answered on 31 Mar 2010, 09:51 AM
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
0
Dominic Savio maria selvaraj
Top achievements
Rank 1
answered on 31 Mar 2010, 10:26 AM

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?

 

 

 

0
Kalin Milanov
Telerik team
answered on 05 Apr 2010, 12:36 PM
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.
Tags
Calendar
Asked by
Dominic Savio maria selvaraj
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Dominic Savio maria selvaraj
Top achievements
Rank 1
Kalin Milanov
Telerik team
Share this question
or