Hello,
This was working in the previous version, but not in R3 2018, with the Office2013 theme.
The column is defined as:
<
tk:GridViewDataColumn
ColumnGroupName
=
"RoleGroup"
DataMemberBinding
=
"{Binding [1]}"
Header
=
"1"
HeaderTextAlignment
=
"Center"
IsGroupable
=
"False"
UniqueName
=
"Set1Role"
Width
=
"35"
>
<
tk:GridViewDataColumn.CellTemplateSelector
>
<
volley:VolleySetPlayerRoleTemplateSelector
NoSet
=
"1"
/>
</
tk:GridViewDataColumn.CellTemplateSelector
>
</
tk:GridViewDataColumn
>
And the text in the header is left aligned, as show in the attached screen shot.
5 Answers, 1 is accepted
I tried to reproduce your problem, using the code snippet you attached, however I did not manage to do so completely.
I can assure you that there is no change since the previous version, regarding RadGridView's HeaderCell style, which means that everything should work and look the same way it did.
I have created a sample project for you, which uses our RadGridView with one column group and three sub columns. One of the sub columns has a CellTemplateSelector, like in your example and the column that groups it with the other two sub columns has its HeaderTextAlignment property set to Center.
Can you please run that project and compare it with yours, and if there are any differences, modify the one that I am attaching, so we can unify them and find the best solution for you?
Regards,
Vicky
Progress Telerik
Hi Vicky,
Thank you for your answer and test project.
I've tried to reproduce the problem with your project, but I can't. I've also tris to solve the problem on my side by simplifying this part of the UI, removing the template selector, the custom styles, etc, but the problem still shows.
The main difference between your project and mine is that, in my case, the grid view is defined as a custom control. After copying the simplified XAML code to the right place, the text alignment is working correctly.
So I think that the culprit is the use of the grid view in a custom control.
If you want, I can create a private ticket and give you access to the source code, but it's huge and written in RemObjects Oxygene.
Tell me if I should give you more information.
Regards
In order to better assist you, could you please provide more detailed information on:
- what custom control do you use RadGridView in - does it inherit RadGridView and does it have any custom logic that may cause this unexpected behavior
- what do you mean by simplified XAML code and right place, as if any custom styles have been defined, there is a big chance that they are the cause of the problem
If it is possible for you, you can try to isolate the problem in a project, similar to the sample one I created for you.
Thank you in advance for your cooperation on the matter.
Vicky
Progress Telerik
Hello Vicky,
I have a small test case that shows the problem. As I cannot upload it, I will now create a ticket to show it.
I have already replied to your ticket in the other thread. I will share the resolution here so that the community can benefit.
After further investigate this I manage to found the reason behind this. The HeaderTextAlignment property relies on a method that comes from the framework: ReadLocalValue. This method should return the value that was locally set (if a local value was set). And this is where the problem occurs.
For some reason when any framework element is placed inside a DataTemplate (such as a Border) the returned value of the ReadLocalValue method is UnsetValue. The RadGridView relies on that this property is actually set (otherwise the text alignment should come from another place, say the TextBlock.TextAlignment attached property of a parent). This faulty value UnsetValue is the reason that some code is not executed and it results in the text alignment not getting correctly set. This behavior is more framework specific related. But still, we will consider adding additional logic for improving the functionality in such case.
I manage to found a workaround which you could use. Place the RadGridView from the DataTemplate inside a UserControl and place that user control inside the DataTemplate. The attached project also demonstrates this. This resolves the UnsetValue issue.
Regards,
Dinko
Progress Telerik