diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2016-02-25 16:56:39 +0100 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2016-02-25 16:56:39 +0100 |
| commit | 76edc3ce44583ee8160ea207dfeb17c4d6508e59 (patch) | |
| tree | 52fa14876f1d155b6beae946c459c5bae35a81c9 | |
| parent | 3cb3ae624a352b92b71a5d7cb19c05f0183f2e43 (diff) | |
expandable image visibility <= Expandable.HasContent property
| -rwxr-xr-x | Templates/Expandable.goml | 5 | ||||
| -rwxr-xr-x | Tests/Interfaces/testExpandable.goml | 8 | ||||
| -rw-r--r-- | src/GraphicObjects/Expandable.cs | 11 |
3 files changed, 18 insertions, 6 deletions
diff --git a/Templates/Expandable.goml b/Templates/Expandable.goml index 2364eeb5..0174aa6d 100755 --- a/Templates/Expandable.goml +++ b/Templates/Expandable.goml @@ -3,7 +3,10 @@ MouseClick="../onMouseClick"> <VerticalStack Height="{../../HeightPolicy}" Width="{../../WidthPolicy}"> <HorizontalStack Spacing="1" Height="-1" Width="{../../../WidthPolicy}"> - <Image Margin="2" Width="12" Height="12" Path="{../../../../Image}" SvgSub="{../../../../IsExpanded}"/> + <Image Margin="2" Width="12" Height="12" + Visible="{../../../../HasContent}" + Path="{../../../../Image}" + SvgSub="{../../../../IsExpanded}"/> <Label Text="{../../../../Caption}" Width="{../../../../WidthPolicy}"/> </HorizontalStack> <Container Name="Content" Visible="false" diff --git a/Tests/Interfaces/testExpandable.goml b/Tests/Interfaces/testExpandable.goml index 1a61085b..60433b25 100755 --- a/Tests/Interfaces/testExpandable.goml +++ b/Tests/Interfaces/testExpandable.goml @@ -1,13 +1,13 @@ <?xml version="1.0"?> <Expandable Fit="true" Caption="Test expandable" Background="DimGray"> - <VerticalStack Margin="5" Background="Green" Fit="true"> +<!-- <VerticalStack Margin="5" Background="Green" Fit="true"> <CheckBox Name="chk1" Background="Red" Fit="true"/> <CheckBox Name="chk2" IsChecked="true" Fit="true"/> <CheckBox Name="chk3" Fit="true"/> <CheckBox Name="chk4" Fit="true"/> -<!-- <HorizontalStack Fit="true" Margin="2" Background="Blue"> + <HorizontalStack Fit="true" Margin="2" Background="Blue"> <Label Name="captionFps" Text="Fps:" Width="30" TextAlignment="Right"/> <Label Name="valueFps" Text="{fps}" Font="droid , 12" Width="-1" TextAlignment="Center" Background="AoEnglish"/> - </HorizontalStack>--> - </VerticalStack> + </HorizontalStack> + </VerticalStack>--> </Expandable> diff --git a/src/GraphicObjects/Expandable.cs b/src/GraphicObjects/Expandable.cs index 3593bf90..16b3e974 100644 --- a/src/GraphicObjects/Expandable.cs +++ b/src/GraphicObjects/Expandable.cs @@ -41,6 +41,7 @@ namespace Crow } set { _contentContainer.SetChild(value); + NotifyValueChanged ("HasContent", HasContent); } } protected override void loadTemplate(GraphicObject template = null) @@ -85,8 +86,12 @@ namespace Crow { if (value == _isExpanded) return; - + _isExpanded = value; + + if (!HasContent) + _isExpanded = false; + NotifyValueChanged ("IsExpanded", _isExpanded); if (_isExpanded) @@ -95,6 +100,10 @@ namespace Crow onCollapse (this, null); } } + [XmlIgnore]public bool HasContent { + get { return _contentContainer == null ? false : _contentContainer.Child != null; } + } + #endregion public virtual void onExpand(object sender, EventArgs e) |