MinimizedButtonContentTemplate does not work with Binding

3 posts, 0 answers
  1. Tobias
    Tobias avatar
    15 posts
    Member since:
    Apr 2013

    Posted 24 Jul 2013 Link to this post

    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. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1183 posts

    Posted 29 Jul 2013 Link to this post

    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 >>
  3. DevCraft banner
  4. Tobias
    Tobias avatar
    28 posts
    Member since:
    Jun 2013

    Posted 29 Jul 2013 Link to this post

    Thanks. It works! :)
Back to Top