How to use DataTemplate in GridDataControl?
How is a DataTemplate applied in a GridDataControl? Is there an example?
In my requirement, the xaml does not contain VisibleColumns. All data and columns are created by binding observable data to the grid's ItemsSource.
The data template is
GridDataControl contains DataTemplate parameter, but setting as follows has no affect:
Is this a bug? How can data defined by binding be formatted?
In my requirement, the xaml does not contain VisibleColumns. All data and columns are created by binding observable data to the grid's ItemsSource.
The data template is
GridDataControl contains DataTemplate parameter, but setting as follows has no affect:
Is this a bug? How can data defined by binding be formatted?
SIGN IN To post a reply.
5 Replies
RA
Rajasekar
Syncfusion Team
March 20, 2012 01:22 PM UTC
Hi Andrew,
Sorry for the inconvenience, We have tested the reported issue in different scenario but we are unable to reproduce the issue. It is wokring fine from our side. Could you please check the below sample?
Sample: http://www.syncfusion.com/downloads/Support/DirectTrac/88378/SyncfusionGDC-1217144405.zip
We suspect you are using our grid in some other scenario, So If possible could you please modify our sample and revert us with replication procedure, that would be very helpful to resolve your problem earlier.
Please let know if you have any queries.
Thanks,
Rajasekar
Sorry for the inconvenience, We have tested the reported issue in different scenario but we are unable to reproduce the issue. It is wokring fine from our side. Could you please check the below sample?
Sample: http://www.syncfusion.com/downloads/Support/DirectTrac/88378/SyncfusionGDC-1217144405.zip
We suspect you are using our grid in some other scenario, So If possible could you please modify our sample and revert us with replication procedure, that would be very helpful to resolve your problem earlier.
Please let know if you have any queries.
Thanks,
Rajasekar
AR
Andrew Rosenblum
March 21, 2012 12:53 PM UTC
Attached is an example based on ObservableCollectionDemo_2010.sln
The data of interest displayed in the grid is of type NoDecimalNumber and TwoDecimalNumber. They are rendered by ToString(). Rows and columns are transposed so a column will contain both types.
I would like to specify the visual formatting (like the StringFormat and right justification) in the xaml code. this work.
How would DataTemplate be used for this? Or could a different xaml attribute be used for the same purpose?
Observable Collection Demo_347e08b7.zip
The data of interest displayed in the grid is of type NoDecimalNumber and TwoDecimalNumber. They are rendered by ToString(). Rows and columns are transposed so a column will contain both types.
I would like to specify the visual formatting (like the StringFormat and right justification) in the xaml code. this work.
How would DataTemplate be used for this? Or could a different xaml attribute be used for the same purpose?
Observable Collection Demo_347e08b7.zip
AR
Andrew Rosenblum
March 21, 2012 12:57 PM UTC
To be clear, ToString should not be used like it is in the example. I would prefer to specify the format string from the xaml. Would also like to specify font and right justify from xaml.
AR
Andrew Rosenblum
March 21, 2012 09:05 PM UTC
Can someone at Syncfusion take a look? Do I need to open a ticket?
RA
Rajasekar
Syncfusion Team
April 18, 2012 12:45 PM UTC
HI Andrew,
Sorry for the delay in getting back to you.
1.You cannot apply string formats in the XAML.
2.You can apply horizontal alignment to the DataTemplate cell by using the below code,
this.grid.Model.QueryCellInfo += new GridQueryCellInfoEventHandler(Model_QueryCellInfo);
void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
e.Style.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
}
3.The above same similar code should be used for applying Fonts to the DataTemplate cell.
Please let us know if you have any queries.
Thanks,
Rajasekar
Sorry for the delay in getting back to you.
1.You cannot apply string formats in the XAML.
2.You can apply horizontal alignment to the DataTemplate cell by using the below code,
this.grid.Model.QueryCellInfo += new GridQueryCellInfoEventHandler(Model_QueryCellInfo);
void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
e.Style.HorizontalAlignment = System.Windows.HorizontalAlignment.Right;
}
3.The above same similar code should be used for applying Fonts to the DataTemplate cell.
Please let us know if you have any queries.
Thanks,
Rajasekar
SIGN IN To post a reply.
- 5 Replies
- 2 Participants
-
AR Andrew Rosenblum
- Mar 19, 2012 09:34 PM UTC
- Apr 18, 2012 12:45 PM UTC