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

Some Question

5 Answers 52 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Fakhru
Top achievements
Rank 2
Fakhru asked on 27 Jul 2009, 04:26 PM
I'm new to Telerik WPF RadGridView, I have question:

1. I want to archive text wraping in RadGridView, but how ?
2. Can I set custom formatting for cell value? I have column long value type, but I want to display it as duration like 01:30.
    I have writing IFormatProvider for it, but don't know how to attach it do RadGridView Column.
3. I want to display row number in RadGridView, how do I do that (example):
    No. Name
    1    A
       B
4. Does RadGridView support saving and loading Layout?

Thx

5 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 28 Jul 2009, 08:51 AM
Hi Fakhru,

1. The GridViewDataColumn class has a property TextWrapping which you could set to Wrap in order to achieve what you need.

2. You should use the DataFormatString property of the column.

3. You will need to add this index to your business object as a property or create a wrapper class around your business object if you cannot modify it. The property should be of type int and return the index of the data item in the data source.

4. Please consult the blog post of my colleague Vladimir Enchev in order to learn how to save and load settings.

Our examples located here are a great place to start learning about  RadGridView, so I encourage you to take a look at them. They come with the full source code which is very helpful as well.

Kind regards,
Ross
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Fakhru
Top achievements
Rank 2
answered on 28 Jul 2009, 02:50 PM
Any example or more clue on  how to archive this:
===================
.
.
.

3. You will need to add this index to your business object as a property or create a wrapper class around your business object if you cannot modify it. The property should be of type int and return the index of the data item in the data source.
===================


0
Missing User
answered on 28 Jul 2009, 03:16 PM
Hi Fakhru,

You can use the attached sample application as a reference.

Best wishes,
Anastasia
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Fakhru
Top achievements
Rank 2
answered on 30 Jul 2009, 11:50 AM
In the example when I do column sort, the line number also sorted.
What I want to do is:

No. Name
1    A
2    B

When sort using column Name, it will:
No. Name
1    B
2    A

Notice the column No will always reflect the row number.
I have other question, do WPF RadGridView have event to format value for column?

Thx
0
Milan
Telerik team
answered on 05 Aug 2009, 06:45 AM
Hi Fakhru,

You could try changing the RowLoaded event handler to:

void RadGridView1_RowLoaded(object sender, RowLoadedEventArgs e)  
{  
    if ((e.Row is GridViewRow) && !(e.Row is GridViewNewRow))  
    {  
        Grid rootGrid = e.Row.ChildrenOfType<Grid>()[0];  
        Person person = e.Row.DataContext as Person;  
 
        var record = this.RadGridView1.FindRecord(person);  
        var index = this.RadGridView1.Records.IndexOf(record);  
 
        rootGrid.Children.Add(new TextBlock() { Text = index.ToString() });  
    }  


Best wishes,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
GridView
Asked by
Fakhru
Top achievements
Rank 2
Answers by
Rossen Hristov
Telerik team
Fakhru
Top achievements
Rank 2
Missing User
Milan
Telerik team
Share this question
or