ThemedLinkMenu in inherited form


Author
Message
Alex Bibiano González
Alex Bibiano González
StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)
Group: Forum Members
Posts: 31, Visits: 125
Excuse me for the lot of questions I'm asking in the last days, but I'm just starting learn SF Crying

I have just created a base form with a ThemedLinkMenu. Now I have inherited some forms and want to add diferent ThemedLinkMenuItem's, but the item's collection is readonly in the derived forms. I have already changed the ThemedLinkMenu modifier to protected, but it's still readonly.

What I'm missing?

Lot of thanks for your time.

Alex B.


Les Pinter
Les Pinter
StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)
Group: Forum Members
Posts: 43, Visits: 213
Hi Alex,

   I hope I understood you correctly. I created a form named MainForm, then added a ThemedLinkMenu. I then set its Modifiers property (under Design properties) to Public. Finally, I add another form that inherits from MainForm, and I'm able to add to its ItemCollection, and to respond to the Click event of the ItemCollection and identify which item was clicked. Does that come anywhere near the issue you describe?

Les

Alex Bibiano González
Alex Bibiano González
StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)
Group: Forum Members
Posts: 31, Visits: 125
Yes you are right, but there's still a problem.

When you add a item to the collection on the base form. If there's an ActionLinkMenuItem to the the itemcollection from the ActionLinkeMenu at the base form, you get a read-only ItemCollection in the inherited form.

Alex Bibiano González
Alex Bibiano González
StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)StrataFrame Beginner (31 reputation)
Group: Forum Members
Posts: 31, Visits: 125
I have found a solution, but I'm not sure if it's the best. Comments are wilkome Smile

I have creates LinkMenuItem class and collection like in the Strataflix sample.

I have published the collection through a public property of the base form, so I can add new LinkMenuItems to the collection in the inherited forms.

On the Form.Load event of the base class, I add all the LinkMenuItems from the collection to the ThemedLinkMenu:

themedLinkMenu1.BeginUpdate();

themedLinkMenu1.ItemCollection.Clear();

foreach (ActionLinkMenuItem almi in ActionItems)

{

themedLinkMenu1.ItemCollection.Add(almi);

}

themedLinkMenu1.EndUpdate();

Thanks,

Alex B.

Les Pinter
Les Pinter
StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)StrataFrame Team Member (73 reputation)
Group: Forum Members
Posts: 43, Visits: 213
Hi Alex,

   I see what you mean; the problem is that the ThemedLinkMenu is marked Read-Only when inherited if the Collection contains any items. That's probably by design, although you can get around it by adding the initial selections in code in the base form's constructor:

    { InitializeComponent();
      ThemedLinkMenuItem themedLinkMenuItem1 = new ThemedLinkMenuItem();
      themedLinkMenuItem1.Key = "Exit";
      themedLinkMenuItem1.Title = "Exit";
      themedLinkMenu1.ItemCollection.Add( themedLinkMenuItem1 );

But your event handler in the forms that derive from it need to handle the default ("Exit" in this case). I also noticed that removing a ThemedLinkMenuItem in the base form's Items Collection doesn't visually clear it from the ThemedLinkMenu. I'm sure Trent has thoughts on the matter.

Les

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search