RadPanelBar RegionAdapter for PRISM

8 posts, 0 answers
  1. Mark Shaw
    Mark Shaw avatar
    11 posts
    Member since:
    Feb 2010

    Posted 01 Mar 2010 Link to this post

    Been trying to port the RadTabControlRegionAdapter to something similiar for the RadPanelBar but without luck.

    If I add control directly to the RadPanelBar, all is well... just when databinding (in this case to Region.ActiveViews) the generated RadPanelBarItems are not pulling in the View content.

    As you can see... nothing special in my code.

    <telerikNavigation:RadPanelBar  
                    DisplayMemberPath="DataContext.Report.Name" 
                    Regions:RegionManager.RegionName="WorkspaceRegion"  
                    ItemContainerStyle="{StaticResource RadPanelBarItemStyle1}" 
                    > 
                </telerikNavigation:RadPanelBar> 

    -Mark


  2. Tihomir Petkov
    Admin
    Tihomir Petkov avatar
    576 posts

    Posted 02 Mar 2010 Link to this post

    Hello Mark,

    Without taking a look at your custom region adapter I won't be able to find the reason for the issue you have. Besides, the RadPanelBar is a bindable ItemsControl and I suspect the region adapter may not be needed at all. Can you please describe in more detail what exactly is the scenario you want to implement?

    Kind regards,
    Tihomir Petkov
    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.
  3. DevCraft banner
  4. Mark Shaw
    Mark Shaw avatar
    11 posts
    Member since:
    Feb 2010

    Posted 02 Mar 2010 Link to this post

    Thanks for the reply!

    Similar to how PRISM regions work... I created an example containing a list of user controls of type FooUserControl. This is then bound to the RadPanelBar. The question is how does one route the user control into the contents of a RadPanelBarItem?. Also... the layout of the panels is odd. The expander buttons are being distributed across the form for some reason.

    The following are the files that complete the solution.

    MainPage.cs
    #region 
     
    using System.Collections.Generic; 
    using System.Windows.Controls; 
    #endregion 
     
    namespace RadPanelBarTest 
        public partial class MainPage 
        { 
            public MainPage() 
            { 
                // Required to initialize variables 
                InitializeComponent(); 
     
                var list = new List<FooUserControl>(); 
     
                for (var i = 0; i < 5; i++) 
                    list.Add(new FooUserControl {Name = "Panel " + i}); 
     
                RadPanelBar.ItemsSource = list; 
            } 
        } 

    MainPage.xaml
    <UserControl 
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:telerikNavigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation" 
        x:Class="RadPanelBarTest.MainPage" 
        Width="640" Height="480"
     
        <Grid x:Name="LayoutRoot" Background="White"
            <telerikNavigation:RadPanelBar  
                DisplayMemberPath="Name" 
                x:Name="RadPanelBar"  
                VerticalAlignment="Stretch"/> 
        </Grid> 
    </UserControl> 


    FooUserControl.cs
    #region 
     
    using System.Windows; 
    using System.Windows.Controls; 
    #endregion 
     
    namespace RadPanelBarTest 
        public partial class FooUserControl 
        { 
            public static readonly DependencyProperty NameProperty = 
                DependencyProperty.Register("Name"typeof (string), typeof (FooUserControl), null); 
     
            public FooUserControl() 
            { 
                // Required to initialize variables 
                InitializeComponent(); 
            } 
     
            public string Name 
            { 
                get { return (string) GetValue(NameProperty); } 
                set { SetValue(NameProperty, value); } 
            } 
     
             
        } 

    FooUserControl.xaml
    <UserControl 
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
        mc:Ignorable="d" 
        x:Class="RadPanelBarTest.FooUserControl" 
        d:DesignWidth="640" d:DesignHeight="480"
     
        <Grid x:Name="LayoutRoot"
            <Ellipse Fill="White" Stroke="Black" Height="71" HorizontalAlignment="Left" Margin="174,104,0,0" VerticalAlignment="Top" Width="74"/> 
            <Ellipse Fill="White" Stroke="Black" Height="71" HorizontalAlignment="Right" Margin="0,104,225,0" VerticalAlignment="Top" Width="71"/> 
            <Ellipse Fill="White" Stroke="Black" Margin="263,168,309,0" Height="68" VerticalAlignment="Top"/> 
            <Ellipse Fill="Black" Stroke="Black" Height="27" HorizontalAlignment="Left" Margin="201,148,0,0" VerticalAlignment="Top" Width="27"/> 
            <Ellipse Fill="Black" Stroke="Black" Height="27" HorizontalAlignment="Right" Margin="0,148,251,0" VerticalAlignment="Top" Width="27"/> 
            <Path Fill="Black" Stretch="Fill" Stroke="Black" Height="36.106" Margin="142.5,0,162.5,174.394" VerticalAlignment="Bottom" UseLayoutRounding="False" Data="M109,270 C230,332 368,293 368,293 L443,273.99994"/> 
            <Path Stretch="Fill" Stroke="Black" Height="30.071" Margin="168.5,0,192.5,177.394" VerticalAlignment="Bottom" UseLayoutRounding="False" Data="M109,270 C230,332 368,293 368,293 L443,273.99994" Fill="White"/> 
        </Grid> 
    </UserControl> 

  5. Tihomir Petkov
    Admin
    Tihomir Petkov avatar
    576 posts

    Posted 02 Mar 2010 Link to this post

    Hi Mark,

    Thanks for the details, I now see your problem. The PanelBar is a hierarchical ItemsControl, so each item in its ItemsSource will be dynamically wrapped in a PanelBarItem. The rendering of your business objects is determined by the DataTemplate you specify. The key point here is that the content of each data item will be rendered in the header of the dynamically created PanelBarItem that wraps it. This is because the control is hierarchical in nature and its items have some content (rendered in an item's header) and a set of subitems (rendered as such below the header). From your explanation I see that you want to have the ellipses from your custom UserControl to be rendered below a PanelBarItem's header. However, keeping in mind the hierarchical nature of the control, this would require you to transform your current list of items to a hierarchical such. This can be done in several ways, but as you are probably aware by now, this would require some fiddling with the structure of your original data.

    I would suggest that you take a look at our OutlookBar control which is quite similar to the PanelBar, but is not hierarchical and may be more suitable to your scenario. Please consider it and let me know if you want to use it instead of the PanelBar. In case you still want to use the PanelBar, let me know and I will create an example for you.

    Best wishes,
    Tihomir Petkov
    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.
  6. Mark Shaw
    Mark Shaw avatar
    11 posts
    Member since:
    Feb 2010

    Posted 02 Mar 2010 Link to this post

    Hey! Thanks for the response. We may be chasing a rabbit on this one. I apologize (pushing the limits i guess).

    Here is what I was trying to build... a horizontally orientated control, with multiple open panels and with the rad html place holder in each one. Imagine a whole bunch of enterprise reports (in java, html, silverlight, asp.net... ) with users sliding things in and out running comparisons. Could be super cool since our our users have up to 3 monitors.

    The outlook bar is great (using it to invoke these reports) but doesn't provide the orientation or multiple selections that the panel bar provides.

    The rub however is that the html host control appears to behave oddly when used in the horizontally oriented panel bars.

    We could close this one out... unless you can create such a solution lol.

    Big thanks either way.
  7. Tihomir Petkov
    Admin
    Tihomir Petkov avatar
    576 posts

    Posted 03 Mar 2010 Link to this post

    Hello Mark,

    Actually while investigating the scenario I found that there is a bug in the HtmlPlaceholder when used in a horizontal PanelBar. I scheduled it for fixing and added 1000 Telerik points to your account. Thank you for your feedback.

    Sincerely yours,
    Tihomir Petkov
    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.
  8. Mark Shaw
    Mark Shaw avatar
    11 posts
    Member since:
    Feb 2010

    Posted 03 Mar 2010 Link to this post

    Very Cool! Hosting HTML content in Silverlight is not much more than a glorious hack but has real world value.

    I look foward to a fix for this cuz what I envision is super cool.

    -mark
  9. Tihomir Petkov
    Admin
    Tihomir Petkov avatar
    576 posts

    Posted 03 Mar 2010 Link to this post

    Hi Mark,

    We haven't scheduled the fix for a particular release yet, since is is a few days before our 2010 Q1 release, but we will work on it soon after that.

    Greetings,
    Tihomir Petkov
    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.
Back to Top
DevCraft banner