Hi everyone. This my drop down menu component
<Panel ux:Class="DropdownMenu" ux:Name="menu" BackgroundColor="#FFF" BorderColor="#BBB" TextColor="#333333" FontSize="14">
<!-- PROPERTIES -->
<object ux:Property="ListItems" />
<string ux:Property="Selected" />
<string ux:Property="Text" />
<float4 ux:Property="TextColor" />
<Brush ux:Property="BackgroundColor" />
<Brush ux:Property="BorderColor" />
<float ux:Property="FontSize" />
<!-- JAVASCRIPT -->
<JavaScript>
var Observable = require('FuseJS/Observable');
var selected = Observable();
function onSelected(arg) {
selected.value = arg.data.name;
//console.log(menu.Selected);
}
module.exports = {
selected: selected,
onSelected: onSelected
}
</JavaScript>
<Panel ux:Class="DropdownOption" ux:Name="self" Height="40">
<string ux:Property="Text" />
<Brush ux:Property="BackgroundColor" />
<Brush ux:Property="BorderColor" />
<float ux:Property="FontSize" />
<float4 ux:Property="TextColor" />
<Rectangle Layer="Background" ux:Name="bgCol" Fill="{ReadProperty self.BackgroundColor}">
<Stroke Brush="{ReadProperty self.BorderColor}" Width="1" />
</Rectangle>
<Text Margin="0,0,10,0" Font="Regular" Alignment="CenterRight" Value="{ReadProperty self.Text}" FontSize="{ReadProperty self.FontSize}" Color="{ReadProperty self.TextColor}" />
</Panel>
<DockPanel Clicked="{onSelected}" ux:Class="DropdownSelectedItem" ux:Name="self" Height="40" >
<string ux:Property="Text" />
<Brush ux:Property="BackgroundColor" />
<Brush ux:Property="BorderColor" />
<float ux:Property="FontSize" />
<float4 ux:Property="TextColor" />
<Image Dock="Right" File="../Assets/Icons/unfold-more.png" Color="{ReadProperty self.TextColor}" Width="24" Height="24" Margin="0" />
<Text Margin="0,0,10,0" Font="Regular" FontSize="{ReadProperty self.FontSize}" Color="{ReadProperty self.TextColor}" Alignment="CenterRight" Value="{ReadProperty self.Text}" />
<Panel Layer="Background">
<Rectangle Layer="Background" Fill="{ReadProperty self.BackgroundColor}" Height="100%" Alignment="Top">
<!--Stroke Brush="{ReadProperty self.BorderColor}" Width="1" /-->
</Rectangle>
</Panel>
</DockPanel>
<!-- PANEL CONTAINING EVERYTHING -->
<Panel Width="100%" Height="40">
<DataBinding Target="menu.Selected" Key="selected" />
<Rectangle>
<Stroke Brush="{ReadProperty menu.BorderColor}" Width="1" />
</Rectangle>
<DropdownSelectedItem TextColor="{ReadProperty menu.TextColor}" FontSize="{ReadProperty menu.FontSize}" Text="{selected}" BackgroundColor="{ReadProperty menu.BackgroundColor}" BorderColor="{ReadProperty menu.BorderColor}" />
<Clicked>
<Toggle Target="expandDropdown" />
</Clicked>
<WhileTrue ux:Name="expandDropdown">
<StackPanel Offset="0,40" >
<Each Items="{ReadProperty menu.ListItems}" >
<DropdownOption FontSize="{ReadProperty menu.FontSize}" TextColor="{ReadProperty menu.TextColor}" Text="{name}" BackgroundColor="{ReadProperty menu.BackgroundColor}" Clicked="{onSelected}" BorderColor="{ReadProperty menu.BorderColor}" />
</Each>
</StackPanel>
</WhileTrue>
</Panel>
</Panel>
When the menu is clicked, the user could click any where and the menu still would be expanded, even when redirected to another page.
i am trying to toggle any instance from that dropdown menu. How can that be acheived?
P.S: I tried to add whileNotFocused
on the component to toggle expandDropdown
but with no luck.