Hi all
I want to create my own controls with some "clustered" standard-controls for use it on various pages, but don't know, how to do it .
I further need to have access to the events in the own control (e.g. button.clicked(), text.changed, etc.).
I have to do this in code (without xaml).
My Idea:
Example Definition of "control-class":
public class EntryMitLoeschButton : StackLayout
{
public EntryMitLoeschButton() // Entry with delete-button
{
var sl = new StackLayout { HeightRequest = 50, WidthRequest = 200, Orientation = StackOrientation.Horizontal };
var MyEntry = new Entry();
var btLoeschen = new Button();
btLoeschen.Text = "XX";
btLoeschen.Clicked += (sender, e) =>
{
MyEntry.Text = "";
};
sl.Children.Add(MyEntry);
sl.Children.Add(btLoeschen);
}
}
On the Page (dont' work):
var objectx = new EntryMitLoeschButton(); // create the "user-object"
PageStack.childred.add(object): // add the user-object to the StackLayout of the page
Eventhandler to Entry MyEntry (in "EntryMitLoeschenButton"):
??xxdont'knowxx??.MyEntry .TextChanged += (sender, e) =>
{// do something};
Questions:
- is that even possible?
- If yes, can somebody drive me in the right direction please?
Thanks a lot for every feedback.