RadOutlookBar and Prism regions

8 posts, 0 answers
  1. Lionel
    Lionel avatar
    19 posts
    Member since:
    Jul 2011

    Posted 10 Aug 2011 Link to this post

    Hello I am actually evaluating Telerik RadControls for WPF for future projects. These projects will use Prism as a modular application guidance.

    So far I have been playing with the OutlookBar without Prism but now I try to integrate it in a modular application I encounter some bugs. My test application is a classical Prism architecture composed of a WPF application for the Shell, an Infrastructure assembly for shared functionalities and of 2 module assemblies.

    The shell is only containing the OutlookBar which holds a Prism region. Then when the modules are loaded, they both publish a view containing only a OutlookBarItem in the OutlookBar region. For this, everything works fine and the views are displayed in the OutlookBar. The problem is that it is clearly improperly displayed. Firstly the items are really thin, you can nearly click on them. Secondly they are displaying their Header property only when collapsed in the overflow bar. Thirdly when you click on one of them the display behavior starts to be really strange, I cannot really describe it. I checked all my bindings with WPF Inspector and Snoop and everything is fine on this side.

    Maybe I am missing something crucial in the usage of OutlookBar within Prism.

    I attached a project reproducing this bug and 2 screenshots so you can have a look at it.

    Steps to reproduce:
    1. Launch the application
    2. Click on the OutlookBarItem to see what is happening

    Thanks for your help.
  2. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 11 Aug 2011 Link to this post

    Hello Lionel,

    I believe in your case it would be best to create a custom region adapter to control the behavior of the RadOutlookBar control as a region. Please have a look at this forum thread and the project attached there. I hope it will get you in the right direction.

    Regards,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  3. Lionel
    Lionel avatar
    19 posts
    Member since:
    Jul 2011

    Posted 11 Aug 2011 Link to this post

    Hello Tina,

    So I tried to use the RegionAdapter you provided but in my case it did not worked. Actually I saw that in the Shell you were overriding the ItemContainerStyle of the RadOutlookBar to make the Title and Header property binding comply with the view model located in a module! I found this kind of surprising, especially for a MVVM pattern. Therefore I have no idea how I can display the correct title in my application without using this "trick".

    Also I saw that the RegionAdapter creates new instances of RadOutlookBarItem to nest the view and then manually add it to the RadOutlookBar items. Don't the control should do that by itself?

    What do you think?
  4. Lionel
    Lionel avatar
    19 posts
    Member since:
    Jul 2011

    Posted 12 Aug 2011 Link to this post

    Thinking again about this issue, I realise that we do not really have choice but edit the ItemContainerStyle, I bet this is simply where the limits of MVVM ends.

    On the other hand, the RegionAdapter should definitely not have to create manually a RadOutlookBarItem. Actually, if I add any UI control in a RadOutlookBar or even a TabControl, it will generate a RadOutlookBarItem, or a TabItem in the other case, that will wrap my UI control. So why should we reimplement an internal mechanism of the original control in a RegionAdapter? I am pretty sure we can make this adapter cleaner and more respectful of the WPF/Prism concepts.

    What do you think?
  5. Lionel
    Lionel avatar
    19 posts
    Member since:
    Jul 2011

    Posted 12 Aug 2011 Link to this post

    I finally modified the RegionAdapter you provided and now it works like a charm without manually reproducing some mechanisms internal to the RadOutlookBar. Here is the adapter I made:

    public class RadOutlookBarRegionAdapter : RegionAdapterBase<RadOutlookBar>
        {
            public RadOutlookBarRegionAdapter(IRegionBehaviorFactory regionBehaviourFactory)
                : base(regionBehaviourFactory) { }
     
            protected override void Adapt(IRegion region, RadOutlookBar regionTarget)
            {
                region.ActiveViews.CollectionChanged +=
                new NotifyCollectionChangedEventHandler((sender, args) =>
                {
                    switch (args.Action)
                    {
                        case NotifyCollectionChangedAction.Add:
                            foreach (UserControl view in args.NewItems)
                            {
                                regionTarget.Items.Add(view);
                            }
                            break;
     
                        case NotifyCollectionChangedAction.Remove:
                            foreach (UserControl view in args.NewItems)
                            {
                                regionTarget.Items.Remove(view);
                            }
                            break;
                    }
                });
            }
     
            protected override IRegion CreateRegion()
            {
                return new AllActiveRegion();
            }
        }

    Also I attached a project demonstrating the use of this adapter.
    The adapter may not be perfect and probably need some tweaks but for now it works pretty well. I am sure it could help other people in the same situation.
  6. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 16 Aug 2011 Link to this post

    Hello Lionel,

    Thank you for your feedback and for sharing your code. I changed this ticket type to Code Library so that the community can take advantage of your approach. I also updated your Telerik account for your input on the matter.

    All the best,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  7. Rajesh
    Rajesh avatar
    1 posts
    Member since:
    Nov 2014

    Posted 25 Nov 2014 Link to this post

    Hie I need Exact and complete Outlook UI Is it possible for me to create or else is it is readily available for me in the telerik Tools please help me 
  8. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1182 posts

    Posted 26 Nov 2014 Link to this post

    Hello Rajesh,

    I understand your requirement and I can tell you that you are one of the many customers requiring the exact same behavior as MS Outlook. Please keep in mind that we develop UI Components. These components provide certain functionality and specific visualization. Most of our components (mostly our ItemsControls) does not provide any further features like sorting, filtering and searching. As for the RadOutlookBar - it provides the core visualization of the MS Outlook. 

    On the other hand, the MS Outlook is an application. All searching, filtering and sorting logic is implemented on application level. Such features cannot be implemented on control level and this is the main reason why our RadOutlookBar cannot provide the full look and feel of MS Outlook.

    However, you as developer will be able to create an application that will look like you require using our UI  components. You can use components like RadRibbonView, RadOutlookBar, RadListBox, RadRibbonWindow, RadScheduleView, RadCalendar, RadSlider and others to build the application you need.

    Regards,
    Pavel R. Pavlov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top