Skip to content

Commit

Permalink
Trying to fix the checkbox / collection view looping problem, to no a…
Browse files Browse the repository at this point in the history
…vail.
  • Loading branch information
Programming-With-Chris committed Aug 16, 2022
1 parent 0a8d153 commit 09a25cb
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 31 deletions.
2 changes: 1 addition & 1 deletion ShoppingList/AppShell.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


<FlyoutItem FlyoutDisplayOptions="AsMultipleItems">
<ShellContent Title="Settings Test"
<ShellContent Title="Settings"
Route="SettingsView"
ContentTemplate="{DataTemplate views:SettingsView}"/>
<!-- Had to remove Icon, it was causing issues on IOS, Settings page wouldn't route-->
Expand Down
6 changes: 0 additions & 6 deletions ShoppingList/Platforms/iOS/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
Expand All @@ -26,10 +24,6 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>CFBundleIdentifier</key>
<string>dev.programmingwithchris.ShoppingList</string>
<key>Build</key>
<integer>1</integer>
<key>XSAppIconAssets</key>
<string>Assets.xcassets/appicon.appiconset</string>
</dict>
Expand Down
23 changes: 17 additions & 6 deletions ShoppingList/ShoppingList.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<ApplicationTitle>ShoppingList</ApplicationTitle>

<!-- App Identifier -->
<ApplicationId>dev.programmingwithchris.ShoppingList</ApplicationId>
<ApplicationId>dev.programmingwithchris.ShoppingList</ApplicationId>
<ApplicationIdGuid>C035DD89-2C0B-4F47-AF16-ACCD775A25F9</ApplicationIdGuid>

<!-- Versions -->
Expand All @@ -32,7 +32,21 @@
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>
</PropertyGroup>
<ProvisioningType>automatic</ProvisioningType>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)'=='net6.0-ios'">
<CodesignKey>Apple Development: Created via API (8TKY844XYR)</CodesignKey>
<CodesignProvision>VS: dev.programmingwithchris.ShoppingList Development</CodesignProvision>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net6.0-ios|AnyCPU'">
<CodesignEntitlements />
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net6.0-ios|AnyCPU'">
<CodesignEntitlements />
</PropertyGroup>


<!--<PropertyGroup Condition="$(TargetFramework) == 'net6.0'">
Expand Down Expand Up @@ -71,8 +85,6 @@
<None Remove="Drawable\" />
<None Remove="Resources\Images\plus_solid.svg" />
<None Remove="Resources\APIs\krogerapiconfig.json" />
<None Remove="Platforms\iOS\Entitlements.plist" />
<None Remove="Platforms\iOS\Info.plist" />
</ItemGroup>

<ItemGroup>
Expand All @@ -82,6 +94,7 @@
<ItemGroup>
<PackageReference Include="CommunityToolkit.Diagnostics" Version="8.0.0" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0" />
<PackageReference Include="Microsoft.Maui.Graphics" Version="6.0.403" />
<PackageReference Include="SQLiteNetExtensions" Version="2.1.0" />
<PackageReference Include="sqlite-net-static" Version="1.8.116" />
</ItemGroup>
Expand Down Expand Up @@ -134,8 +147,6 @@
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="Platforms\iOS\Entitlements.plist" />
<EmbeddedResource Include="Platforms\iOS\Info.plist" />
<EmbeddedResource Include="Resources\Images\plus_solid.svg" />
</ItemGroup>

Expand Down
15 changes: 9 additions & 6 deletions ShoppingList/View/UserListDetails.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,25 @@

<Grid ColumnDefinitions="*,*,*"
ColumnSpacing="3"
RowDefinitions="*,*,Auto">
RowDefinitions="*,Auto">

<RefreshView Grid.ColumnSpan="3" Command="{Binding RefreshUserListDetailScreenCommand}"
<!--<RefreshView Grid.ColumnSpan="3" Command="{Binding RefreshUserListDetailScreenCommand}"
CommandParameter="UserListCollectionView"
IsRefreshing="{Binding IsRefreshing}"
Grid.Row="0">
Grid.Row="0">-->
<CollectionView ItemsSource="{Binding UserList.Items}"
CanReorderItems="True"
SelectionMode="None"
x:Name="UserListCollectionView">
x:Name="UserListCollectionView"
Grid.ColumnSpan="3"
Grid.Row="0">

<CollectionView.ItemTemplate >
<DataTemplate x:DataType="model:Item">
<Grid Padding="10"
ColumnDefinitions="*,*,*"
RowDefinitions="*,Auto">
<Frame Grid.ColumnSpan="2"
<Frame Grid.ColumnSpan="3"
Padding="10"
Margin="0,0,0,10"
x:Name="ItemFrame"
Expand Down Expand Up @@ -71,6 +73,7 @@
Grid.Row="1"
Grid.Column="2"
Grid.ColumnSpan="2"
HorizontalOptions="End"
/>
<!--<VerticalStackLayout Grid.Column="5"
Grid.Row="0"
Expand All @@ -95,7 +98,7 @@
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</RefreshView>
<!-- </RefreshView>-->

<GraphicsView Drawable="{StaticResource circularButton}"
Grid.Row="2"
Expand Down
4 changes: 1 addition & 3 deletions ShoppingList/View/UserListDetails.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ public UserListDetails(UserListDetailViewModel userListDetailViewModel)

public void OnCheckboxClicked(object sender, CheckedChangedEventArgs e)
{
if (_ulvm.PreventCheckEvent == true)
return;

CheckBox thisCheckbox = sender as CheckBox;

Expand All @@ -55,7 +53,7 @@ public void OnCheckboxClicked(object sender, CheckedChangedEventArgs e)
currentFrame.FadeTo(1, 1000);

//thisCheckbox.CheckedChanged -= OnCheckboxClicked;
//itemThatWasClicked.IsCompleted = thisCheckbox.IsChecked;
itemThatWasClicked.IsCompleted = thisCheckbox.IsChecked;
_ulvm.ItemWasChecked(itemThatWasClicked);
//thisCheckbox.CheckedChanged += OnCheckboxClicked;

Expand Down
10 changes: 1 addition & 9 deletions ShoppingList/ViewModel/UserListDetailViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
using Newtonsoft.Json.Linq;
using System.Collections.ObjectModel;
using System.Diagnostics;

namespace ShoppingList.ViewModels;
namespace ShoppingList.ViewModels;

[QueryProperty("UserList", "UserList")]
public partial class UserListDetailViewModel : BaseViewModel
{
readonly ItemService _itemService;
readonly KrogerAPIService _krogerAPIService;

public bool PreventCheckEvent { get; set; } = false;

public UserListDetailViewModel()
{
_itemService = new();
Expand Down Expand Up @@ -157,11 +151,9 @@ public async void OnItemEntryCompleted(string itemName)

private void UserListNotifers()
{
PreventCheckEvent = true;
OnUserListChanged(UserList);
OnPropertyChanged(nameof(UserList));
OnPropertyChanged(nameof(UserList.Items));
PreventCheckEvent = false;
}
}

Expand Down

0 comments on commit 09a25cb

Please sign in to comment.