1. I cannot change the RadTreeMapItem template to take the whole square are it just takes the area of its controls (see image attached) 2. How can i make the border between the items to be one insteatd of 2 lines one by the other (see same image) Here is my style:
<
telerik:HierarchicalDataTemplate
x:Key
=
"DefaultItemTemplate"
ItemsSource
=
"{Binding Children}"
>
<
Grid
VerticalAlignment
=
"Stretch"
HorizontalAlignment
=
"Stretch"
Background
=
"BurlyWood"
>
<
TextBlock
TextWrapping
=
"Wrap"
Text
=
"{Binding Label}"
Opacity
=
"1"
>
<!--<
TextBlock.Effect
>
<
DropShadowEffect
BlurRadius
=
"4"
ShadowDepth
=
"0"
/>
</
TextBlock.Effect
>-->
</
TextBlock
>
</
Grid
>
</
telerik:HierarchicalDataTemplate
>
<
Style
x:Key
=
"RadTreeMapStyle2"
TargetType
=
"telerik:RadTreeMap"
>
<
Setter
Property
=
"Template"
>
<
Setter.Value
>
<
ControlTemplate
TargetType
=
"telerik:RadTreeMap"
>
<
telerik:RadTreeMapItem
x:Name
=
"PART_RootItem"
BorderBrush
=
"{TemplateBinding BorderBrush}"
BorderThickness
=
"{TemplateBinding BorderThickness}"
Background
=
"{TemplateBinding Background}"
DataMappingSelector
=
"{TemplateBinding DataMappingSelector}"
DataContext
=
"{x:Null}"
ItemTemplate
=
"{StaticResource DefaultItemTemplate}"
ItemsSource
=
"{TemplateBinding DataView}"
ItemTemplateSelector
=
"{TemplateBinding ItemTemplateSelector}"
LayoutStrategies
=
"{TemplateBinding LayoutStrategies}"
Mappings
=
"{TemplateBinding Mappings}"
Padding
=
"{TemplateBinding Padding}"
/>
</
ControlTemplate
>
</
Setter.Value
>
</
Setter
>
</
Style
>
12 Answers, 1 is accepted
This is a known issue of RadTreeMapItem. In the RadTreeMap and RadPivotMap it is used for displaying both groups of items and items. In the template of the RadTreemapItem you can find a ContentPresenter for the displayed text and ItemsPresenter for the children. When there are no children ItemsPresenter should not be visible and the whole space should be given to the ContentPresenter. There are properties controlling the horizontal and vertical orientation of the content that you can use (HorizontalContentAlignment and VerticalContentAlignment). Our developers are currently looking for a solution to this problem. The fix is expected to be released for the Q3 release.
Regards,Yavor Ivanov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
I couldn't find the ItemsPresenter in the template in order to hide it. Can you provide a short sample code?
Thanks
Roei
The ItemPresenter and ContentPresenter are parts of the RadTreeMapItem ControlTemplate. Currently it looks like this:
<
ControlTemplate
TargetType
=
"treemaps:RadTreeMapItem"
>
<
Border
Background
=
"{TemplateBinding Background}"
BorderBrush
=
"{TemplateBinding BorderBrush}"
BorderThickness
=
"{TemplateBinding BorderThickness}"
>
<
Grid
Margin
=
"{TemplateBinding Padding}"
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"Auto"
/>
<
RowDefinition
Height
=
"*"
/>
</
Grid.RowDefinitions
>
<
ContentPresenter
Grid.Row
=
"0"
Content
=
"{TemplateBinding Header}"
ContentTemplate
=
"{TemplateBinding HeaderTemplate}"
HorizontalAlignment
=
"{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment
=
"{TemplateBinding VerticalContentAlignment}"
/>
<
ItemsPresenter
Grid.Row
=
"1"
/>
</
Grid
>
</
Border
>
</
ControlTemplate
>
The ItemsPresenter has to be hidden only for the leaf items, because hiding it for all items will break the hierarchy as it is used for displaying the child items.
Greetings,
Yavor Ivanov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
If i set
<ItemsPresenter Grid.Row="1" Visibility="Collapsed"/> No item is shown. Am i missing something here?
As Yavor mentioned, this is what our developers will be looking to fix for Q3 2011. Can you elaborate why you need this? If it is for the sole purpose to fill the entire item with the desired background you can use one of our colorizers. E.g. in order to get all the items in the same color -- use the BrushColorizer:
<
telerik:TypeDefinition
ValuePath=... >
<
telerik:TypeDefinition.Mappings
>
<
telerik:BrushColorizer
Brush
=
"BurlyWood"
/>
</
telerik:TypeDefinition.Mappings
>
</
telerik:TypeDefinition
>
As for the borders -- each item has a border and the default Margin is 1, hence you see them doubled. You can set the RadTreeMapItem margin to 0, so there will be no space between them and they will appear as a single border:
<
Style
TargetType
=
"telerik:RadTreeMapItem"
>
<
Setter
Property
=
"Margin"
Value
=
"0,0,0,0"
/>
</
Style
>
Best regards,
Ves
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
My purpose is not to colorize the background, this i can achieve easly with the brushes as mentioned in your examples.
I have a template which contains some text blocks and i cannot set their container (e.g grid, stack panel, border etc) to stretch both horizontally and vertically because i want one text block to be at the top another one in the middle and a third one at the bottom.
Thanks
Roei
Yavor wrote: "The ItemsPresenter has to be hidden only for the leaf items, because hiding it for all items will break the hierarchy as it is used for displaying the child items."
How can i hide the ItemsPresenter for leaf items only?????
Thanks
Roei
Thanks for the details. This will be included in the next release.
Meanwhile, you can give it a try by downloading the Latest Internal Build and using this snippet:
<
telerik:RadTreeMap.TypeDefinitions
>
<
telerik:TypeDefinition
ValuePath=...>
<
telerik:TypeDefinition.ItemStyle
>
<
Style
TargetType
=
"telerik:RadTreeMapItem"
>
<
Setter
Property
=
"Control.Foreground"
Value
=
"Green"
/>
<
Setter
Property
=
"Template"
>
<
Setter.Value
>
<
ControlTemplate
>
<
Border
BorderBrush
=
"Red"
BorderThickness
=
"2"
>
<
TextBlock
Text
=
"{Binding Value}"
VerticalAlignment
=
"Center"
/>
</
Border
>
</
ControlTemplate
>
</
Setter.Value
>
</
Setter
>
</
Style
>
</
telerik:TypeDefinition.ItemStyle
>
Best regards,
Ves
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
I am afraid -- no other way for the moment. Is there anything that would not allow you to apply this implementation?
Regards,
Ves
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>
i am afraid that i'll won't use this control because of this issue and i won't switch all my project assemblies for this.
I just need to find other control that suits this minimal requirement.
Roei
That's the point of the Latest Internal Builds we make public every Monday -- you can try the features/fixes and decide whether they work for you. We would not expect you to use these assemblies in your final product. You can just validate the concepts and quickly implement them once the next official release is out. The 2011 Q2 Service Pack 1 is expected in mid-September.
Best regards,
Ves
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>