From 205a4c2c6858803385762d3b9321584cc8300e5d Mon Sep 17 00:00:00 2001 From: konekoneko Date: Sun, 9 Mar 2014 16:39:53 +0900 Subject: [PATCH 1/1] =?utf8?q?Visibility.Collapsed=E3=81=8CVisibility?= =?utf8?q?=E3=81=AB=E8=A8=AD=E5=AE=9A=E3=81=95=E3=82=8C=E3=81=A6=E3=81=84?= =?utf8?q?=E3=82=8B=E3=81=AB=E3=82=82=E9=96=A2=E3=82=8F=E3=82=89=E3=81=9A?= =?utf8?q?=E3=80=81=E6=8F=8F=E5=86=99=E3=81=95=E3=82=8C=E3=81=A6=E3=81=97?= =?utf8?q?=E3=81=BE=E3=81=86=E4=B8=8D=E5=85=B7=E5=90=88=E3=82=92=E4=BF=AE?= =?utf8?q?=E6=AD=A3=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Metro/FooEditEngine/FooTextBox.cs | 5 +++-- Metro/Test/AppSettings.cs | 16 +++++++++++++++- Metro/Test/MainPage.xaml.cs | 1 + Metro/Test/SettingsFlyout.xaml | 1 + WPF/FooEditEngine/FooTextBox.cs | 2 +- 5 files changed, 21 insertions(+), 4 deletions(-) diff --git a/Metro/FooEditEngine/FooTextBox.cs b/Metro/FooEditEngine/FooTextBox.cs index 22ac9a8..3f76473 100644 --- a/Metro/FooEditEngine/FooTextBox.cs +++ b/Metro/FooEditEngine/FooTextBox.cs @@ -953,6 +953,7 @@ namespace FooEditEngine.Metro if (this.peer != null) this.peer.OnNotifyCaretChanged(); this.View.IsFocused = true; + this.Focus(FocusState.Programmatic); this.Refresh(); } @@ -976,7 +977,7 @@ namespace FooEditEngine.Metro } void Refresh(Rectangle updateRect) { - if (this.rectangle.ActualWidth == 0 || this.rectangle.ActualHeight == 0/* || !this.Render.IsCanDraw()*/) + if (this.rectangle.ActualWidth == 0 || this.rectangle.ActualHeight == 0 || this.Visibility == Windows.UI.Xaml.Visibility.Collapsed) return; this.Render.BegineDraw(); @@ -1163,7 +1164,7 @@ namespace FooEditEngine.Metro { source.View.HideRuler = !source.DrawRuler; source._Controller.JumpCaret(source.View.CaretPostion.row, source.View.CaretPostion.col); - } + } } #endregion diff --git a/Metro/Test/AppSettings.cs b/Metro/Test/AppSettings.cs index 38224ba..320bee5 100644 --- a/Metro/Test/AppSettings.cs +++ b/Metro/Test/AppSettings.cs @@ -37,7 +37,7 @@ namespace Test } } - bool _IsRTL, _ShowRuler, _ShowLineNumber, _ShowLineMarker, _HilightXML; + bool _IsRTL, _ShowRuler, _ShowLineNumber, _ShowLineMarker, _HilightXML, _IsVisible = true; ObservableCollection _LineBreakMethodList; LineBreakMethodItem _CurrentLineBreakMethod; @@ -63,6 +63,20 @@ namespace Test } } + public bool IsVisible + { + get + { + return this._IsVisible; + } + set + { + this._IsVisible = value; + if (ChangedSetting != null) + ChangedSetting(this, null); + } + } + public bool IsRTL { get diff --git a/Metro/Test/MainPage.xaml.cs b/Metro/Test/MainPage.xaml.cs index 1ceeeed..5042971 100644 --- a/Metro/Test/MainPage.xaml.cs +++ b/Metro/Test/MainPage.xaml.cs @@ -90,6 +90,7 @@ namespace Test this.fooTextBox.Hilighter = null; this.fooTextBox.LayoutLineCollection.ClearHilight(); } + this.fooTextBox.Visibility = setting.IsVisible ? Visibility.Visible : Visibility.Collapsed; this.fooTextBox.LineBreakMethod = setting.CurrentLineBreakMethod.Method; this.fooTextBox.LineBreakCharCount = 50; this.fooTextBox.Refresh(); diff --git a/Metro/Test/SettingsFlyout.xaml b/Metro/Test/SettingsFlyout.xaml index a7a2bfe..c2f2c5a 100644 --- a/Metro/Test/SettingsFlyout.xaml +++ b/Metro/Test/SettingsFlyout.xaml @@ -16,6 +16,7 @@ + diff --git a/WPF/FooEditEngine/FooTextBox.cs b/WPF/FooEditEngine/FooTextBox.cs index 17084f7..57370cb 100644 --- a/WPF/FooEditEngine/FooTextBox.cs +++ b/WPF/FooEditEngine/FooTextBox.cs @@ -431,7 +431,7 @@ namespace FooEditEngine.WPF void Refresh(Rectangle updateRect) { - if (this.disposed) + if (this.disposed || this.Visibility == Visibility.Collapsed) return; this.timer.Stop(); -- 2.11.0