This repository has been archived by the owner on May 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 474
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix badge view default text "0" (#1959)
- Loading branch information
1 parent
da30dde
commit 89a363e
Showing
6 changed files
with
93 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<pages:BasePage xmlns="http://xamarin.com/schemas/2014/forms" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
xmlns:pages="clr-namespace:Xamarin.CommunityToolkit.Sample.Pages" | ||
xmlns:vm="clr-namespace:Xamarin.CommunityToolkit.Sample.ViewModels.TestCases" | ||
xmlns:xct="http://xamarin.com/schemas/2020/toolkit" | ||
x:Class="Xamarin.CommunityToolkit.Sample.Pages.TestCases.Issue1900Page"> | ||
<pages:BasePage.BindingContext> | ||
<vm:Issue1900ViewModel /> | ||
</pages:BasePage.BindingContext> | ||
<ContentPage.Content> | ||
<Grid RowDefinitions="*, *, auto" | ||
Padding="12"> | ||
<xct:BadgeView Text="{Binding Counter}" | ||
AutoHide="False" | ||
VerticalOptions="Center" | ||
Grid.Row="0"> | ||
<Label Text="Badge should be visible and display 0 as text" | ||
Margin="6" /> | ||
</xct:BadgeView> | ||
<xct:BadgeView Text="{Binding Counter}" | ||
VerticalOptions="Center" | ||
Grid.Row="1"> | ||
<Label Text="Badge should not be visible" | ||
Margin="6" /> | ||
</xct:BadgeView> | ||
<Button Text="Increment" | ||
Command="{Binding ClickCommand}" | ||
Grid.Row="2" /> | ||
</Grid> | ||
</ContentPage.Content> | ||
</pages:BasePage> |
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,20 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
using Xamarin.Forms; | ||
using Xamarin.Forms.Xaml; | ||
|
||
namespace Xamarin.CommunityToolkit.Sample.Pages.TestCases | ||
{ | ||
[XamlCompilation(XamlCompilationOptions.Compile)] | ||
public partial class Issue1900Page : BasePage | ||
{ | ||
public Issue1900Page() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
samples/XCT.Sample/ViewModels/TestCases/Issue1900ViewModel.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,29 @@ | ||
using System.Threading.Tasks; | ||
using System.Windows.Input; | ||
using Xamarin.CommunityToolkit.ObjectModel; | ||
|
||
namespace Xamarin.CommunityToolkit.Sample.ViewModels.TestCases | ||
{ | ||
public class Issue1900ViewModel : BaseViewModel | ||
{ | ||
int counter; | ||
|
||
public int Counter | ||
{ | ||
get => counter; | ||
set => SetProperty(ref counter, value); | ||
} | ||
|
||
public ICommand ClickCommand => new AsyncCommand(Click); | ||
|
||
public Issue1900ViewModel() | ||
{ | ||
} | ||
|
||
Task Click() | ||
{ | ||
Counter++; | ||
return Task.CompletedTask; | ||
} | ||
} | ||
} |
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