Adding OutlookBarItems to OutlookBar and displaying the content of the OutlookbarItem

2 posts, 0 answers
  1. pradeep
    pradeep avatar
    5 posts
    Member since:
    Aug 2010

    Posted 18 Aug 2010 Link to this post

    I am trying to Wrap RadOutlookBar and make MYOUTLOOKBAR so that i can expose only few properties in MYOUTLOOKBAR.
    In this senario i need to add radoutlookbarItems to MYOUTLOOKBAR.

    Even if i add MYoutlookbarItem to MYOUTLOOKBAR ..In xaml i was able to look at the change.
    But in design i  dont see any Item getting added to the Outlookbar.

    if add content to this Newly added MYOutlookBarItem from properties tab, i get  an error message saying that

    "Property Value is not Valid"
    (in detail: Property "content" does not support string to value conversation)

    How to add items to outlookbar so that the items of the outlookbar should support exposed properties of radoutlookbar control?

    Here is an example code...for Items property of MyOutlookbar.cs




    Property: Items




    private MYOutlookBarItemCollection _items;




    public MYOutlookBarItemCollection Items













    if (_items == null)



    _items =


    new MYOutlookBarItemCollection ();





    return _items;













    The above code exposes the items property in MYoutlookbar

    MYOutlookBarItemCollection.cs will be a separate will which contains
    public class MYOutlookBarItemCollection: ObservableCollection<MYOutlookBarItem>







    Here is an example code...for content property of MyOutlookbarItem.cs




    Property: Content




    public object Content





    get { return (object)GetValue(ContentProperty); }




    set { SetValue(ContentProperty, value); }





    public static readonly DependencyProperty ContentProperty =








    "Content", typeof(object), typeof(MyOutlookBarItem),




    new FrameworkPropertyMetadata



    PropertyChangedCallback = (obj, e) =>




    as MyOutlookBarItem).UpdateContent((object)e.NewValue);






    private void UpdateContent(object sel)



    OutlookBarItem.Content = sel;



     Can you guys help me..


  2. Tina Stancheva
    Tina Stancheva avatar
    3298 posts

    Posted 23 Aug 2010 Link to this post

    Hi Deepz,

    When you inherit the RadOutlookBar and RadOutlookBarItem you expose all their properties. In such cases, when you add new properties to your classes, they are exposed alongside the existing properties of the RadOutlookBar control.

    After I examined the code you provided I noticed that in the MYOutlookBar.cs, which inherits the RadOutlookBar, an Items property is defined. However, since a property with the same name exists in the RadOutlookBar class, you cannot define it again. This is causing the issues you described.
    If you want to define an entirely new property, you will need to use a different name - MyItems for example.

    The same goes for the MYOutlookBarItem class where the Content property is an existing property in the RadOutlookItem class.

    This being said, I wanted to ask you to elaborate on your scenario a bit more. What properties do you need to expose? Why do you need additional properties? Can you use the existing RadOutlookBar and RadOutlookBarItem properties instead? If you can give us more details about the requirements of your scenario, we will be able to provide you with a better suited solution.

    Thank you in advance.

    Sincerely yours,
    Tina Stancheva
    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
Back to Top