RadTreeMapItem not stretching

13 posts, 1 answers
  1. Roei
    Roei avatar
    29 posts
    Member since:
    Feb 2011

    Posted 04 Aug 2011 Link to this post

    Hi

    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>
    Thanks Roei
  2. Answer
    Yavor
    Admin
    Yavor avatar
    401 posts

    Posted 09 Aug 2011 Link to this post

    Hi Roei,

    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 >>

  3. DevCraft banner
  4. Roei
    Roei avatar
    29 posts
    Member since:
    Feb 2011

    Posted 09 Aug 2011 Link to this post

    Hi Yavor,

    I couldn't find the ItemsPresenter in the template in order to hide it. Can you provide a short sample code?
     
    Thanks

    Roei
  5. Yavor
    Admin
    Yavor avatar
    401 posts

    Posted 11 Aug 2011 Link to this post

    Hi 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 >>

  6. Roei
    Roei avatar
    29 posts
    Member since:
    Feb 2011

    Posted 11 Aug 2011 Link to this post

    How can i set it to be hidden only foe leaf items? 
    If i set 
     <ItemsPresenter Grid.Row="1" Visibility="Collapsed"/>
    No item is shown. Am i missing something here?
  7. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 16 Aug 2011 Link to this post

    Hello Roei,

    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 >>

  8. Roei
    Roei avatar
    29 posts
    Member since:
    Feb 2011

    Posted 16 Aug 2011 Link to this post

    Hi Ves,

    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
  9. Roei
    Roei avatar
    29 posts
    Member since:
    Feb 2011

    Posted 18 Aug 2011 Link to this post

    Hi

    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
  10. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 18 Aug 2011 Link to this post

    Hi 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 >>

  11. Roei
    Roei avatar
    29 posts
    Member since:
    Feb 2011

    Posted 18 Aug 2011 Link to this post

    no other way to "tell" the ItemsPresenter not to save space for the children he doesn't have?
  12. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 23 Aug 2011 Link to this post

    Hello Roei,

    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 >>

  13. Roei
    Roei avatar
    29 posts
    Member since:
    Feb 2011

    Posted 23 Aug 2011 Link to this post

    Hi Ves

    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 
  14. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 23 Aug 2011 Link to this post

    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 >>

Back to Top
DevCraft banner