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

MinimizedButtonContentTemplate does not work with Binding

2 Answers 52 Views
OutlookBar
This is a migrated thread and some comments may be shown as answers.
Tobias
Top achievements
Rank 1
Tobias asked on 24 Jul 2013, 10:52 AM
Hi folks,
I have a custom <telerik:RadOutlookBar.MinimizedButtonContentTemplate>:

<telerik:RadOutlookBar.MinimizedButtonContentTemplate>
    <DataTemplate>
        <StackPanel>
            <TextBlock Text="{Binding Path=MinimizedTitle}" />
        </StackPanel>
    </DataTemplate>
</telerik:RadOutlookBar.MinimizedButtonContentTemplate>

If I set the Text to a default value like Text="My text.", everything works. But if I use the {Binding}, I don't see any text.
The Binding works as expected in another controls.

Do you have any idea? Thanks a lot!

Greetz,
- Tobias

2 Answers, 1 is accepted

Sort by
0
Pavel R. Pavlov
Telerik team
answered on 29 Jul 2013, 10:53 AM
Hello Tobias,

Thank you for contacting us on this matter. I can see that you try to bind the Text property of the TextBlock to a property defined in your ViewModel. In order to do this you need to make sure that the DataContext of the UserControl is propagated to the Button inside the RadOutlookBar control. You can do this by using the following code:

<telerik:RadOutlookBar x:Name="xOutlookBar"
                       IsMinimized="True"
                       MinimizedButtonContent="{Binding}"
                       Width="400">
    <telerik:RadOutlookBar.MinimizedButtonContentTemplate>
        <DataTemplate>
            <StackPanel>
                <TextBlock Text="{Binding TestText}" />
            </StackPanel>
        </DataTemplate>
    </telerik:RadOutlookBar.MinimizedButtonContentTemplate>
    <telerik:RadOutlookBarItem Header="Item 1"/>
</telerik:RadOutlookBar>

Please try this approach out and let me know if you need further assistance.

Regards,
Pavel R. Pavlov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Tobias
Top achievements
Rank 1
answered on 29 Jul 2013, 11:50 AM
Thanks. It works! :)
Tags
OutlookBar
Asked by
Tobias
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
Tobias
Top achievements
Rank 1
Share this question
or