Changing DocumentPage.Text on the active page causes its content to lose focus.
Actual Behavior
Changing DocumentPage.Text should not alter the focused component.
Steps to Reproduce the Problem
In the supplied code:
Click on the textbox to focus it
Start typing
Observe how the TextBox.TextChanged handler adds a * to DocumentPage.Text and now the textbox is no longer focused.
I believe this happens because ThemedDocumentControlHandler.SetPageContent() always sets Content to null before setting it to something else.
In my actual code I'm using a custom Drawable and I noticed that OnLostFocus() does not get called, but OnUnLoad() is.
Code that Demonstrates the Problem
using System;
using Eto.Drawing;
using Eto.Forms;
namespace DocumentControlTest
{
public class MainForm : Form
{
private DocumentPage _page;
public MainForm()
{
Title = "My Eto Form";
MinimumSize = new Size(400, 400);
var textBox = new TextBox();
textBox.TextChanged += TextBox_TextChanged;
var page = new DocumentPage
{
Text = "Tab1",
Content = new StackLayout
{
Items =
{
textBox
}
}
};
var documentControl = new DocumentControl();
documentControl.Pages.Add(page);
Content = documentControl;
_page = page;
}
private void TextBox_TextChanged(object sender, EventArgs e)
{
_page.Text += "*";
}
}
}
Specifications
Version: 2.8.2
Platform(s): macOS (probably affects others too, since the Handler is used on many)
Expected Behavior
Changing
DocumentPage.Text
on the active page causes its content to lose focus.Actual Behavior
Changing
DocumentPage.Text
should not alter the focused component.Steps to Reproduce the Problem
In the supplied code:
TextBox.TextChanged
handler adds a*
toDocumentPage.Text
and now the textbox is no longer focused.I believe this happens because
ThemedDocumentControlHandler.SetPageContent()
always sets Content to null before setting it to something else.In my actual code I'm using a custom Drawable and I noticed that
OnLostFocus()
does not get called, butOnUnLoad()
is.Code that Demonstrates the Problem
Specifications