-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
af1ec30
commit 3c52ab1
Showing
15 changed files
with
545 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using CommunityToolkit.Mvvm.ComponentModel; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace DemoApp.ViewModels | ||
{ | ||
public partial class DropDownSampleViewModel : ObservableObject | ||
{ | ||
[ObservableProperty] | ||
private int selectedIndex; | ||
[ObservableProperty] | ||
private List<string> dropdownSource; | ||
[ObservableProperty] | ||
public List<string> colorSource; | ||
public DropDownSampleViewModel() | ||
{ | ||
DropdownSource = new List<string>() { "Excavator", "Bulldozer", "Loader", "Grader", "Trencher", "Backhoe", "Compactors", "Crane" }; | ||
ColorSource = new List<string>() { "Red", "Yellow", "Black" }; | ||
SelectedIndex = 6; ; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
xmlns:modus="http://modus.trimble.com/components" | ||
x:Class="DemoApp.Views.DropDownSamplePage" | ||
Title="DropDownSamplePage"> | ||
<StackLayout HorizontalOptions="Start" Padding="10" Spacing="13"> | ||
|
||
<Label Text="Equipment Type:"/> | ||
<modus:TMDropDown ItemsSource="{Binding DropdownSource}" SelectedIndex="{Binding SelectedIndex}" ></modus:TMDropDown> | ||
<Label Text="Color"/> | ||
<modus:TMDropDown ItemsSource="{Binding ColorSource}" ></modus:TMDropDown> | ||
|
||
</StackLayout> | ||
</ContentPage> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using DemoApp.ViewModels; | ||
namespace DemoApp.Views; | ||
|
||
public partial class DropDownSamplePage : ContentPage | ||
{ | ||
public DropDownSamplePage() | ||
{ | ||
InitializeComponent(); | ||
BindingContext = new DropDownSampleViewModel(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
Trimble.Modus.Components/Controls/DropDown/DropDownViewCell.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
namespace Trimble.Modus.Components; | ||
|
||
public class DropDownViewCell : ViewCell | ||
{ | ||
internal Label label; | ||
public static readonly BindableProperty TextProperty = | ||
BindableProperty.Create(nameof(Text), typeof(string), typeof(DropDownViewCell), ""); | ||
|
||
public string Text | ||
{ | ||
get { return (string)GetValue(TextProperty); } | ||
set { SetValue(TextProperty, value); } | ||
} | ||
|
||
public DropDownViewCell() | ||
{ | ||
label = new Label | ||
{ | ||
TextColor = Colors.Black, | ||
FontAttributes = FontAttributes.None, | ||
BackgroundColor = Colors.Transparent, | ||
VerticalOptions = LayoutOptions.Center, | ||
HorizontalOptions = LayoutOptions.Start, | ||
Padding = new Thickness(8, 12) | ||
}; | ||
|
||
label.SetBinding(Label.TextProperty, new Binding("Text", source: this)); | ||
|
||
View = new StackLayout | ||
{ | ||
Children = { label }, | ||
BackgroundColor = Colors.Transparent, | ||
}; | ||
} | ||
internal void UpdateBackgroundColor(Color backgroundColor, bool textAttribute) | ||
{ | ||
View.BackgroundColor = backgroundColor; | ||
label.FontAttributes = textAttribute ? FontAttributes.Bold : FontAttributes.None; | ||
} | ||
} |
Oops, something went wrong.