RadPane.Title issue

9 posts, 0 answers
  1. Manuel Felício
    Manuel Felício avatar
    64 posts
    Member since:
    Oct 2009

    Posted 17 Nov 2009 Link to this post

    Hello,

    RadPane.Title is a string property but there is a RadPane.TitleTemplate. Why not make the Title an object property instead of a string property and treat it like Header/HeaderTemplate ? In this case we'll be able to declare a datatemplate for Title with bindings.

    Anyway, my goal was to have a datatemplate for TitleTemplate that had a ContentPresenter for the Title string and some buttons bound to commands that I had declared in a viewmodel class that would be bound to the Title Property (I can't do this because it's a string!).

    Best regards,

    MF.
  2. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 18 Nov 2009 Link to this post

    Hello Manuel,

    The main reason why we keep it string and not an object is because it is not expected to be a visual element and if we use object we cannot stop the user to put a visual element in it. On the other hand it cannot be a visual element, because it might be displayed in more than one places. 
    We will think about a way to enable your scenario, but unfortunately this will not happen earlier than Q1 2010 as this will be a breaking change.

    Best wishes,
    Miroslav Nedyalkov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft banner
  4. Manuel Felício
    Manuel Felício avatar
    64 posts
    Member since:
    Oct 2009

    Posted 19 Nov 2009 Link to this post

    Thanks for your reply Miroslav.

    I don't think it would be a breaking change since you can set String value into an Object property with no compile errors. Existing projects won't stop working. You could use a default template with a TextBlock for the Title when it is a String value and when it is some random object just let the user specify the data template.

    Anyway, why can't it be a visual element? If you can specify a datatemplate for it you can make the Title be anything.

    Best regards,

    MF.
  5. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 20 Nov 2009 Link to this post

    Hi Manuel,

    Yes, you are right - you will be able to set string to object, but if some is setting the Title to some variable of type string this will stop compiling.

    You are right for the DataTemplate as well but this is not what I wanted to say - it won't be allowed to set a visual element to the Title property directly (the title is displayed in more than one place).

    Regards,
    Miroslav Nedyalkov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  6. Manuel Felício
    Manuel Felício avatar
    64 posts
    Member since:
    Oct 2009

    Posted 21 Nov 2009 Link to this post

    Hi,

    You are right, setting the title to a variable of type string would cause a compile error. I didn't think of that, sorry.

    I guess I'll have to dig deeper in control templates to accomplish what I'm trying to do.

    Thanks,

    MF.
  7. srinu p
    srinu p avatar
    1 posts
    Member since:
    May 2010

    Posted 06 Oct 2010 Link to this post

    Hi,

       I was looking for this as well. I still don't see the Title as Object instead of 'String" as of 10/6/2010.
       Can you suggest a workaround to bind my buttons and menus which are on the template ?


    Thanks
  8. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 11 Oct 2010 Link to this post

    Hi Srinu,

    As there is no good work-around for this problem we are planning to change the type of the Title property.

    Greetings,
    Miroslav Nedyalkov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  9. Bryce
    Bryce avatar
    32 posts
    Member since:
    Aug 2010

    Posted 14 Dec 2011 Link to this post

    Hello,

    Just in case anyone wants a workaround, I found a way to add buttons to the TitleTemplate that are bound to your viewmodel. This is how you do it:

    <telerik:RadDocking>
           <telerik:RadSplitContainer Width="800" telerik:StyleManager.Theme="Metro" Orientation="Horizontal" InitialPosition="DockedRight" telerik:ProportionalStackPanel.RelativeSize="100, 100">
                                <telerik:RadPaneGroup telerik:StyleManager.Theme="Metro">
                                    <telerik:RadPane CanUserClose="False" CanUserPin="True" ContextMenuTemplate="{x:Null}" Header="{Binding SelectedCase}">
                                        <telerik:RadPane.TitleTemplate>
                                            <DataTemplate>
                                                <StackPanel Orientation="Horizontal" Visibility="{Binding Converter={StaticResource NullVisibilityConverter}}">
                                                    <HyperlinkButton Foreground="White" Content="{Binding CustomerName}" NavigateUri="{Binding AccountUrl}" />
                                                    <TextBlock Text=" - " />
                                                    <Button Content="hello" Command="{Binding Test}" />
                                                </StackPanel>
                                            </DataTemplate>
                                        </telerik:RadPane.TitleTemplate>
                                        <Grid Background="White" Visibility="{Binding SelectedCase, Converter={StaticResource NullVisibilityConverter}, Mode=TwoWay}">
                                            <View:TileContentLarge DataContext="{Binding SelectedCase}"/>
                                        </Grid>
                                    </telerik:RadPane>
                                </telerik:RadPaneGroup>
                            </telerik:RadSplitContainer>
                        </telerik:RadDocking>

    What you do is you have your Header in your RadPane bind to your ViewModel, and then you create a TitleTemplate that has buttons, and bind to the commands/properties in your view model. When I click on the button in my TitleTemplate, I am able to access the command in my ViewModel.

    Just wanted to post this just in case anyone comes across this thread.

    Bryce
  10. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 15 Dec 2011 Link to this post

    Hello Bryce,

    Thank you for sharing your code. This wasn't possible before changing the type of the Title property from String to object and currently this is the recommended way to achieve this.

    Greetings,
    Miroslav Nedyalkov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top
DevCraft banner