This is a migrated thread and some comments may be shown as answers.

RadPane.Title issue

8 Answers 157 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Manuel Felício
Top achievements
Rank 1
Manuel Felício asked on 17 Nov 2009, 06:09 PM
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.

8 Answers, 1 is accepted

Sort by
0
Miroslav Nedyalkov
Telerik team
answered on 18 Nov 2009, 12:27 PM
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.
0
Manuel Felício
Top achievements
Rank 1
answered on 19 Nov 2009, 10:17 AM
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.
0
Miroslav Nedyalkov
Telerik team
answered on 20 Nov 2009, 01:27 PM
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.
0
Manuel Felício
Top achievements
Rank 1
answered on 21 Nov 2009, 08:56 AM
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.
0
srinu p
Top achievements
Rank 1
answered on 06 Oct 2010, 03:32 PM
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
0
Miroslav Nedyalkov
Telerik team
answered on 11 Oct 2010, 03:40 PM
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
0
Bryce
Top achievements
Rank 1
answered on 15 Dec 2011, 01:43 AM
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
0
Miroslav Nedyalkov
Telerik team
answered on 15 Dec 2011, 10:13 AM
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 >>

Tags
Docking
Asked by
Manuel Felício
Top achievements
Rank 1
Answers by
Miroslav Nedyalkov
Telerik team
Manuel Felício
Top achievements
Rank 1
srinu p
Top achievements
Rank 1
Bryce
Top achievements
Rank 1
Share this question
or