This is a migrated thread and some comments may be shown as answers.

Adding OutlookBarItems to OutlookBar and displaying the content of the OutlookbarItem

1 Answer 38 Views
OutlookBar
This is a migrated thread and some comments may be shown as answers.
pradeep
Top achievements
Rank 1
pradeep asked on 18 Aug 2010, 12:39 PM
Hi,
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

#region

 

 

Property: Items

 

 

 

private MYOutlookBarItemCollection _items;

 

 

 

public MYOutlookBarItemCollection Items

 

{

 

 

get

 

 

 

 

{

 

 

if (_items == null)

 

{

_items =

 

new MYOutlookBarItemCollection ();

 

}

 

 

return _items;

 

}

}

 

 

#endregion

 

 

 

 

 

 

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


#region

 

 

Property: Content

 

 

 

public object Content

 

{

 

 

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

 

 

 

set { SetValue(ContentProperty, value); }

 

}

 

 

public static readonly DependencyProperty ContentProperty =

 

 

 

DependencyProperty.Register(

 

 

 

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

 

 

 

new FrameworkPropertyMetadata

 

{

PropertyChangedCallback = (obj, e) =>

{

(obj

 

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

 

}

});

 

 

private void UpdateContent(object sel)

 

{

OutlookBarItem.Content = sel;

}

#endregion

 Can you guys help me..

Thanks,
Deepz

1 Answer, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 23 Aug 2010, 03:04 PM
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
Tags
OutlookBar
Asked by
pradeep
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Share this question
or