ElementBinding height of HeaderSelectedItem

3 posts, 1 answers
  1. Johannes
    Johannes avatar
    66 posts
    Member since:
    Dec 2012

    Posted 14 Jan 2014 Link to this post

    - Please see attached screenshot -


    The toolbar on the right side of the screen (blue line above "toolbar" buttons) should always have the same height as the HeaderSelectedItem element of the OutlookBar on the left. So when a user switches his theme at runtime, the toolbars height should adjust with the new selected theme. For example "Office 2013" and "Windows 8" themes use different heights. I tried that with the following code where "MyOutlookBar" is the key of my RadOutlookBar:



    <!-- ToolBar Area -->
    <StackPanel Orientation="Horizontal" Height="{Binding ElementName=MyOutlookBar, Path=HeaderSelectedItem.Height}">
        <Image Source="{Binding ToolBarIcon}" Stretch="None" />
        <TextBlock Text="{Binding ToolBarTitle}" />
    </StackPanel>




    Sadly there is no "HeaderSelectedItem" property which I can refer to. How is that element accessible?







  2. Answer
    Martin
    Admin
    Martin avatar
    1099 posts

    Posted 17 Jan 2014 Link to this post

    Hi Johannes,

    Indeed there is no HeaderSelectedItem property in our RadOutlookBar and there is no easy approach to get the height of the RadOutlookBar's header. Since every theme has different size of the items, I think the most suitable way to achieve your requirement is to extract the heights of all themes from the implicit themes of the control (or with any XAML inspecting tool) in a collection. And then you can manually change the tool bar's height when you change the theme.

    For your convenience, I prepared a sample project achieving your requirement. Also, I encourage you to use our RadToolBar control instead of the ToolBar Area from your XAML.

    I hope this information is helpful.

    Regards,
    Martin Ivanov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    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. UI for WPF is Visual Studio 2017 Ready
  4. Johannes
    Johannes avatar
    66 posts
    Member since:
    Dec 2012

    Posted 17 Jan 2014 Link to this post

    Thank you very much for your response and the attached project. I will use the solution you suggested.
Back to Top