Skip to content

Commit

Permalink
Fix behaviors binding context
Browse files Browse the repository at this point in the history
  • Loading branch information
VladislavAntonyuk committed Dec 21, 2024
1 parent eeec3e2 commit 7bff365
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 11 deletions.
2 changes: 2 additions & 0 deletions Database/MauiTaskListApp/Views/EditTaskView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,12 @@

<Entry Text="{Binding Task.Description}"
Placeholder="Task description"
x:Name="TaskEntry"
Grid.Row="3">

<Entry.Behaviors>
<toolkit:MultiValidationBehavior x:Name="MultiValidationTarefa"
BindingContext="{Binding Path=BindingContext, Source={x:Reference TaskEntry}, x:DataType=Entry}"
Flags="ValidateOnValueChanged">

<toolkit:TextValidationBehavior MinimumLength="1"
Expand Down
7 changes: 6 additions & 1 deletion IPTVPlayer/Views/ChannelsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,25 @@
<Grid RowDefinitions="60, 60, *">
<Picker Title="Playlist"
Grid.Row="0"
x:Name="Playlist"
ItemsSource="{Binding Sources}"
SelectedIndex="{Binding SelectedIndex}">
<Picker.Behaviors>
<behaviors:EventToCommandBehavior
x:TypeArguments="TextChangedEventArgs"
BindingContext="{Binding Path=BindingContext, Source={x:Reference Playlist}, x:DataType=Picker}"
EventName="SelectedIndexChanged"
Command="{Binding LoadDataCommand}" />
</Picker.Behaviors>
</Picker>
<Entry Placeholder="Search" Grid.Row="1"
<Entry Placeholder="Search"
Grid.Row="1"
x:Name="Search"
ClearButtonVisibility="WhileEditing">
<Entry.Behaviors>
<behaviors:EventToCommandBehavior
x:TypeArguments="TextChangedEventArgs"
BindingContext="{Binding Path=BindingContext, Source={x:Reference Search}, x:DataType=Entry}"
EventName="TextChanged"
Command="{Binding SearchCommand}" />
</Entry.Behaviors>
Expand Down
1 change: 0 additions & 1 deletion IPTVPlayer/Views/ChannelsPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public ChannelsPage(ChannelsViewModel viewModel)
BindingContext = viewModel;
}


protected override async void OnNavigatedTo(NavigatedToEventArgs args)
{
base.OnNavigatedTo(args);
Expand Down
Binary file modified LocalPackages/VladislavAntonyuk.Balloon.1.6.4.1.nupkg
Binary file not shown.
Binary file not shown.
6 changes: 4 additions & 2 deletions MauiAnimation/Controls/Sky.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@
<Grid WidthRequest="200" HeightRequest="200"
HorizontalOptions="End"
VerticalOptions="Start"
Margin="10">
Margin="10"
x:Name="Grid">
<Grid.Behaviors>
<toolkit:AnimationBehavior>
<toolkit:AnimationBehavior
BindingContext="{Binding Path=BindingContext, Source={x:Reference Grid}, x:DataType=Grid}">
<toolkit:AnimationBehavior.AnimationType>
<animations:SunAnimation />
</toolkit:AnimationBehavior.AnimationType>
Expand Down
4 changes: 3 additions & 1 deletion MauiBank/Views/CardPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@
<ScrollView>
<VerticalStackLayout Margin="0,30,0,0">
<Border Margin="30"
Background="#1e1e1e">
Background="#1e1e1e"
x:Name="Border">
<Border.StrokeShape>
<RoundRectangle CornerRadius="40" />
</Border.StrokeShape>
Expand Down Expand Up @@ -275,6 +276,7 @@
</Grid>
<Border.Behaviors>
<toolkit:AnimationBehavior
BindingContext="{Binding Path=BindingContext, Source={x:Reference Border}, x:DataType=Border}"
Command="{Binding Source={x:Reference Name=CardsPage},Path=BindingContext.SwitchCvvModeCommand}">
<toolkit:AnimationBehavior.AnimationType>
<animations:FlipAnimation />
Expand Down
8 changes: 5 additions & 3 deletions MauiPaint/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,11 @@
<Label Text="Rotate"/>
<Slider x:Name="RotateSlider" Maximum="360">
<Slider.Behaviors>
<mct:EventToCommandBehavior EventName="ValueChanged"
Command="{Binding RotateCommand}"
CommandParameter="{Binding Path=Value, Source={x:Reference RotateSlider}}"/>
<mct:EventToCommandBehavior
BindingContext="{Binding Path=BindingContext, Source={x:Reference RotateSlider}, x:DataType=Slider}"
EventName="ValueChanged"
Command="{Binding RotateCommand}"
CommandParameter="{Binding Path=Value, Source={x:Reference RotateSlider}}"/>
</Slider.Behaviors>
</Slider>
</VerticalStackLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ public override void SetAppearance(BottomNavigationView bottomView, IShellAppear
protected override void SetBackgroundColor(BottomNavigationView bottomView, Color color)
{
base.SetBackgroundColor(bottomView, color);
bottomView.RootView?.SetBackgroundColor(shellContext.Shell.CurrentItem.BackgroundColor.ToPlatform());
var page = shellContext.Shell.CurrentItem.Window.Page;
if (page is not null)
{
bottomView.RootView?.SetBackgroundColor(page.BackgroundColor.ToPlatform());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public void SetAppearance(UINavigationController controller, ShellAppearance app
baseTracker.SetAppearance(controller, appearance);
if (controller.View is not null && shellContext.Shell.CurrentItem is not null)
{
controller.View.BackgroundColor = shellContext.Shell.CurrentItem.BackgroundColor.ToPlatform();
controller.View.BackgroundColor = shellContext.Shell.CurrentItem.Window.Page?.BackgroundColor.ToPlatform();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void SetAppearance(UINavigationController controller, ShellAppearance app
baseTracker.SetAppearance(controller, appearance);
if (controller.View is not null && shellContext.Shell.CurrentItem is not null)
{
controller.View.BackgroundColor = shellContext.Shell.CurrentItem.BackgroundColor.ToPlatform();
controller.View.BackgroundColor = shellContext.Shell.CurrentItem.Window.Page?.BackgroundColor.ToPlatform();
}
}

Expand Down

0 comments on commit 7bff365

Please sign in to comment.