StrataFrame Forum
Back
Login
Login
Home
»
StrataFrame Application Framework - V1
»
WinForms (How do I?)
»
ThemedContainer BodyHiddenEventHandler question
ThemedContainer BodyHiddenEventHandler question
Post Reply
Like
1
ThemedContainer BodyHiddenEventHandler question
View
Flat Ascending
Flat Descending
Threaded
Options
Subscribe to topic
Print This Topic
RSS Feed
Goto Topics Forum
Author
Message
Greg McGuffey
Greg McGuffey
posted 14 Years Ago
ANSWER
Post Details
Share Post
Group: Forum Members
Posts: 2K,
Visits: 6.6K
Let us know how it goes!
Reply
Like
1
Keith Chisarik
Keith Chisarik
posted 14 Years Ago
ANSWER
Post Details
Share Post
Group: StrataFrame Users
Posts: 939,
Visits: 40K
Yes, they are created via code at runtime. I will try your suggestion, thanks.
Keith Chisarik
Sigma Data Systems
Reply
Like
1
Greg McGuffey
Greg McGuffey
posted 14 Years Ago
ANSWER
Post Details
Share Post
Group: Forum Members
Posts: 2K,
Visits: 6.6K
The typical way to handle this is to just have a handler for each container. That won't work if you are dynamically creating them (I'm assuming you mean you create them via code at runtime). So, what comes to mind is to create a class for the handler. It would have properties for any items you need access to in the handler and a public methods for the handlers (one for BodyHidden and one for BodyRestore).
public class ContainerImageSwitcher
{
/// <summary>
/// Require that a ThemedContainer be provided in constructor.
/// </summary>
public ContainerImageSwitcher(ThemedContainer container)
{
this.Container = container;
}
public property ThemedContainer Container { get; set;}
public void HandleHidden() { //-- show image, using this.Container }
public void HandleRestore() { //-- hide image, using this.Container }
}
Now in your code that creates the ThemedContainers and sets the handlers you can use the class:
private ThemedContainer BuildContainer()
{
ThemedContainer newContainer = new ThemedContainer();
//-- Setup as appropriate....
//-- Add handlers
ContainerImageSwitcher switcher = new
ContainerImageSwitcher(newContainer);
newContainer.BodyHidden +=
switcher.HandleHidden;
newContainer.BodyRestore +=
switcher
.HandleRestore;
//-- Return container
return newContainer;
}
I haven't tested this, but it should work.
Tags
Event Handling
Reply
Like
1
Keith Chisarik
Keith Chisarik
posted 14 Years Ago
ANSWER
Topic Details
Share Topic
Group: StrataFrame Users
Posts: 939,
Visits: 40K
I have a form on which I dynamically create X number of ThemedContainer controls, I add a handler for the BodyHidden event on creation of the control but the delegate BodyHiddenEventHandler does not have a signature that includes sender. When the events fires I dont know which themedcontainer was collapsed.
I want to show the TitleImage when the body is collapsed and hide it when it is expanded. How can I accomplish this?
Keith Chisarik
Sigma Data Systems
Reply
Like
1
GO
Merge Selected
Merge into selected topic...
Merge into merge target...
Merge into a specific topic ID...
Open Merge
Post Reply
Like
1
Similar Topics
Post Quoted Reply
Reading This Topic
Login
Login
Remember Me
Reset Password
Resend Validation Email
Login
Explore
Messages
Mentions
Search