Padding = (DeviceInfo.IsPortrait ? new Extents(32, 32, 0, 0) : new Extents(64, 64, 0, 0)).SpToPx(),
};
AddTopView();
- AddTopViewElements();
AddSearchBox();
+ AddTopViewElements();
AddCollectionView();
UpdateSearchView();
TouchEvent += (object source, TouchEventArgs e) => false;
backButton = new Button("BackButton")
{
ThemeChangeSensitive = true,
- Size2D = new Size2D(48, 48).SpToPx(),
+ WidthSpecification = 48.SpToPx(),
+ HeightSpecification = 48.SpToPx(),
Margin = new Extents(0, 24, 0, 0).SpToPx(),
};
topView.Add(backButton);
FontFamily = "BreezeSans",
Margin = new Extents(0, 32, 0, 0).SpToPx(),
VerticalAlignment = VerticalAlignment.Center,
+ HorizontalAlignment = HorizontalAlignment.Begin,
FontStyle = UIFontStyles.NormalLight,
};
topView.Add(searchLabel);
RelativeLayout.SetLeftTarget(searchLabel, backButton);
RelativeLayout.SetLeftRelativeOffset(searchLabel, 1.0f);
+ RelativeLayout.SetRightTarget(searchLabel, searchBox);
+ RelativeLayout.SetRightRelativeOffset(searchLabel, 0.0f);
RelativeLayout.SetFillHorizontal(searchLabel, true);
+ RelativeLayout.SetHorizontalAlignment(searchLabel, RelativeLayout.Alignment.Start);
RelativeLayout.SetVerticalAlignment(searchLabel, RelativeLayout.Alignment.Center);
}
{
StyleName = "SearchBox",
ThemeChangeSensitive = true,
- Size2D = new Size2D(648, 60).SpToPx(),
- Margin = new Extents(0, 32, 0, 0).SpToPx(),
+ WidthSpecification = ((int)(Window.Instance.WindowSize.Width * 0.6f) > 648 ? 648 : (int)(Window.Instance.WindowSize.Width * 0.6f)).SpToPx(),
+ HeightSpecification = 60.SpToPx(),
+ Padding = new Extents(24, 24, 0, 0).SpToPx(),
Layout = new FlexLayout()
{
Direction = FlexLayout.FlexDirection.Row,
Justification = FlexLayout.FlexJustification.FlexStart,
},
};
+ topView.Add(searchBox);
+ RelativeLayout.SetRightTarget(searchBox, topView);
+ RelativeLayout.SetRightRelativeOffset(searchBox, 1.0f);
+ RelativeLayout.SetHorizontalAlignment(searchBox, RelativeLayout.Alignment.End);
+ RelativeLayout.SetVerticalAlignment(searchBox, RelativeLayout.Alignment.Center);
Button searchButton = new Button("SearchIcon")
{
ThemeChangeSensitive = true,
Name = "searchbutton",
- Margin = new Extents(24, 0, 10, 10).SpToPx(),
- Position2D = new Position2D(24, 10).SpToPx(),
+ Margin = new Extents(0, 20, 0, 0).SpToPx(),
};
+ searchBox.Add(searchButton);
+
textField = new TextField()
{
StyleName = "TextField",
ThemeChangeSensitive = true,
Name ="Textfield",
- Size2D = new Size2D(460, 40).SpToPx(),
+ WidthSpecification = 256.SpToPx(),
+ HeightSpecification = 60.SpToPx(),
BackgroundColor = Color.Transparent,
- Position2D = new Position2D(88, 10).SpToPx(),
- Margin = new Extents(24, 0, 10, 10).SpToPx(),
PixelSize = 32.SpToPx(),
PlaceholderText = "Type Here",
PlaceholderTextFocused = "Search music",
+ HorizontalAlignment = HorizontalAlignment.Begin,
+ VerticalAlignment = VerticalAlignment.Center,
};
+ searchBox.Add(textField);
+ FlexLayout.SetFlexGrow(textField, 1.0f);
textField.TextChanged += TextFieldTextChanged;
crossButton = new Button("ClearButton")
{
ThemeChangeSensitive = true,
Name = "crossButton",
- Margin = new Extents(24, 0, 6, 6).SpToPx(),
- Position2D = new Position2D(572, 6).SpToPx(),
+ Margin = new Extents(20, 0, 0, 0).SpToPx(),
};
- crossButton.Clicked += CrossButtonClicked;
-
- searchBox.Add(searchButton);
- searchBox.Add(textField);
searchBox.Add(crossButton);
+ crossButton.Clicked += CrossButtonClicked;
crossButton.Hide();
- topView.Add(searchBox);
- RelativeLayout.SetLeftTarget(searchBox, searchLabel);
- RelativeLayout.SetLeftRelativeOffset(searchLabel, 1.0f);
- RelativeLayout.SetRightTarget(searchBox, topView);
- RelativeLayout.SetRightRelativeOffset(searchBox, 1.0f);
- RelativeLayout.SetHorizontalAlignment(searchBox, RelativeLayout.Alignment.End);
- RelativeLayout.SetVerticalAlignment(searchBox, RelativeLayout.Alignment.Center);
}
private void TextFieldTextChanged(object sender, TextField.TextChangedEventArgs e)
if (string.IsNullOrEmpty(searchText))
{
crossButton.Hide();
- crossButton.IsSelectable = false;
}
else
{
crossButton.Show();
- crossButton.IsSelectable = true;
}
viewModel.UpdateSearchViewModel(searchText);
UpdateSearchView();