summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls/LegacyRepro
diff options
context:
space:
mode:
authorJason Smith <jason.smith@xamarin.com>2016-03-22 13:02:25 -0700
committerJason Smith <jason.smith@xamarin.com>2016-03-22 16:13:41 -0700
commit17fdde66d94155fc62a034fa6658995bef6fd6e5 (patch)
treeb5e5073a2a7b15cdbe826faa5c763e270a505729 /Xamarin.Forms.Controls/LegacyRepro
downloadxamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.tar.gz
xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.tar.bz2
xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.zip
Initial import
Diffstat (limited to 'Xamarin.Forms.Controls/LegacyRepro')
-rw-r--r--Xamarin.Forms.Controls/LegacyRepro/Page1.xaml13
-rw-r--r--Xamarin.Forms.Controls/LegacyRepro/Page1.xaml.cs193
-rw-r--r--Xamarin.Forms.Controls/LegacyRepro/SampleViewCell.xaml34
-rw-r--r--Xamarin.Forms.Controls/LegacyRepro/SampleViewCell.xaml.cs149
4 files changed, 389 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls/LegacyRepro/Page1.xaml b/Xamarin.Forms.Controls/LegacyRepro/Page1.xaml
new file mode 100644
index 00000000..52990d9a
--- /dev/null
+++ b/Xamarin.Forms.Controls/LegacyRepro/Page1.xaml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ xmlns:CustomViewCell="clr-namespace:App2;assembly=Xamarin.Forms.Controls"
+ x:Class="App2.Page1">
+ <ListView x:Name="itemListView" RowHeight="75" HeightRequest="700" SeparatorColor="#061018" BackgroundColor="Blue" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
+ <ListView.ItemTemplate>
+ <DataTemplate>
+ <CustomViewCell:SampleViewCell />
+ </DataTemplate>
+ </ListView.ItemTemplate>
+ </ListView>
+</ContentPage> \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/LegacyRepro/Page1.xaml.cs b/Xamarin.Forms.Controls/LegacyRepro/Page1.xaml.cs
new file mode 100644
index 00000000..8bed2771
--- /dev/null
+++ b/Xamarin.Forms.Controls/LegacyRepro/Page1.xaml.cs
@@ -0,0 +1,193 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using System.Text;
+using System.Threading.Tasks;
+using Xamarin.Forms;
+
+namespace App2
+{
+ public partial class Page1 : ContentPage
+ {
+ public Page1()
+ {
+ InitializeComponent();
+
+ ObservableCollection<CheckListDetails> objlist = new ObservableCollection<CheckListDetails>();
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Completed });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Completed });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Completed });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Completed });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "ActionAction", ChecklistStatus = CheckListStatus.Completed });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Completed });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "ActionAction", ChecklistStatus = CheckListStatus.Completed });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.OverRide });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.OverRide });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.OverRide });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.OverRide });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "ActionAction", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "ActionAction", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "", Action = "", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "", Action = "", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "", Action = "", ChecklistStatus = CheckListStatus.Completed });
+ objlist.Add(new CheckListDetails() { CallOut = "", Action = "", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "", Action = "", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "", Action = "", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "", Action = "", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "", Action = "", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "", Action = "", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "", Action = "", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "", Action = "", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "", Action = "", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "", Action = "", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "", Action = "", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "", Action = "", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "", Action = "", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.OverRide });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "ActionAction", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "ActionAction", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.OverRide });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "ActionAction", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "Action", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "ActionAction", ChecklistStatus = CheckListStatus.Default });
+ objlist.Add(new CheckListDetails() { CallOut = "AAAAA", Action = "", ChecklistStatus = CheckListStatus.Default });
+
+
+ itemListView.ItemsSource = objlist;
+ }
+ }
+
+ public class CheckListDetails
+ {
+ string _callout;
+ string _action;
+ string _currentStatusD;
+
+ CheckListStatus _checklistStatus = CheckListStatus.Default;
+
+ public CheckListDetails()
+ {
+ _currentStatusD = string.Empty;
+ }
+
+ public CheckListStatus ChecklistStatus
+ {
+ get { return _checklistStatus; }
+ set
+ {
+ if (value == CheckListStatus.Default)
+ {
+
+ }
+
+ SetProperty(ref _checklistStatus, value);
+ }
+ }
+
+ public string CurrentStatusD
+ {
+ get { return _currentStatusD; }
+ set { SetProperty(ref _currentStatusD, value); }
+ }
+
+ public string Action
+ {
+ get { return _action; }
+ set { SetProperty(ref _action, value); }
+ }
+
+ public string CallOut
+ {
+ get { return _callout; }
+ set { SetProperty(ref _callout, value); }
+ }
+
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
+ {
+ if (Equals(storage, value))
+ {
+ return false;
+ }
+
+ storage = value;
+ OnPropertyChanged(propertyName);
+ return true;
+ }
+
+ protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
+ {
+ var handler = PropertyChanged;
+
+ if (handler != null)
+ {
+ PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
+ }
+ }
+ }
+
+ public enum CheckListStatus
+ {
+ Default,
+ Completed,
+ Pending,
+ OverRide
+ }
+}
diff --git a/Xamarin.Forms.Controls/LegacyRepro/SampleViewCell.xaml b/Xamarin.Forms.Controls/LegacyRepro/SampleViewCell.xaml
new file mode 100644
index 00000000..f360b4d8
--- /dev/null
+++ b/Xamarin.Forms.Controls/LegacyRepro/SampleViewCell.xaml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<ViewCell xmlns="http://xamarin.com/schemas/2014/forms"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ x:Class="App2.SampleViewCell">
+ <ViewCell.View>
+ <Grid x:Name="OuterGrid" HeightRequest="75" HorizontalOptions="FillAndExpand" VerticalOptions="Start" BackgroundColor="Red" Padding="20,0,30,0">
+ <!--<Grid.Resources>
+ <ResourceDictionary>
+ <FormsLib:StringToColorConverter x:Key="StringToColorConverter" />
+ </ResourceDictionary>
+ </Grid.Resources>-->
+ <Grid.GestureRecognizers>
+ <TapGestureRecognizer Tapped="Checklist_tapped" />
+ </Grid.GestureRecognizers>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="*" />
+ </Grid.RowDefinitions>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="50" />
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ <ColumnDefinition Width="Auto" />
+ </Grid.ColumnDefinitions>
+
+ <Image x:Name="completedimg" HorizontalOptions="Start" VerticalOptions="Center" Grid.Row="0" Grid.Column="0" IsVisible="true"/>
+
+ <Label Text="{Binding CallOut}" TextColor="Yellow" FontSize="17" FontFamily="Roboto" XAlign="Start" HorizontalOptions="Start" VerticalOptions="Center" Grid.Row="0" Grid.Column="1" />
+ <Label Text="........................................................................................................................................................................." LineBreakMode ="NoWrap" TextColor="Yellow" HorizontalOptions="FillAndExpand" VerticalOptions="Center" Grid.Row="0" Grid.Column="2" />
+ <Label Text="{Binding Action}" FontSize="17" TextColor="Yellow" FontFamily="Roboto" XAlign="End" HorizontalOptions="End" VerticalOptions="Center" Grid.Row="0" Grid.Column="3" />
+
+ </Grid>
+
+ </ViewCell.View>
+</ViewCell> \ No newline at end of file
diff --git a/Xamarin.Forms.Controls/LegacyRepro/SampleViewCell.xaml.cs b/Xamarin.Forms.Controls/LegacyRepro/SampleViewCell.xaml.cs
new file mode 100644
index 00000000..f7808d1b
--- /dev/null
+++ b/Xamarin.Forms.Controls/LegacyRepro/SampleViewCell.xaml.cs
@@ -0,0 +1,149 @@
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Xamarin.Forms;
+
+
+namespace App2
+{
+
+ public partial class SampleViewCell : ViewCell
+ {
+ MenuItem _overRideItemmenuitem = null;
+ public SampleViewCell()
+ {
+ try
+ {
+ InitializeComponent();
+
+ _overRideItemmenuitem = new MenuItem();
+ _overRideItemmenuitem.Text = "Over Ride";
+ _overRideItemmenuitem.IsDestructive = true;
+ _overRideItemmenuitem.Clicked += OverRide_Clicked;
+
+ //this.ContextActions.Add(OverRideItemmenuitem);
+
+ //Height = 300;
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ }
+
+ void OverRide_Clicked(object sender, EventArgs e)
+ {
+ try
+ {
+ var obj = (CheckListDetails)((MenuItem)sender).BindingContext;
+ obj.ChecklistStatus = CheckListStatus.OverRide;
+
+ SetContextActions();
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ }
+
+ void Checklist_tapped(object sender, EventArgs e)
+ {
+ try
+ {
+ var selectItem = (CheckListDetails)((Grid)sender).BindingContext;
+
+ if (selectItem != null && selectItem.ChecklistStatus != CheckListStatus.OverRide)
+ {
+ selectItem.ChecklistStatus = CheckListStatus.Completed;
+
+ SetContextActions();
+ }
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ }
+
+ //protected override void OnPropertyChanged(string propertyName = null)
+ //{
+ // base.OnPropertyChanged(propertyName);
+ // if(propertyName == ViewCell.BindingContextProperty.PropertyName)
+ // {
+ // setContextActions();
+ // }
+ //}
+ protected override void OnBindingContextChanged()
+ {
+ base.OnBindingContextChanged();
+ SetContextActions();
+ }
+
+ void SetContextActions()
+ {
+ try
+ {
+ if (BindingContext != null)
+ {
+ var obj = (CheckListDetails)BindingContext;
+
+ if (obj.ChecklistStatus == CheckListStatus.Default)
+ {
+ if (ContextActions.Count == 0)
+ {
+ ContextActions.Add(_overRideItemmenuitem);
+ }
+ }
+ else if (obj.ChecklistStatus == CheckListStatus.Completed)
+ {
+ if (ContextActions.Count > 0)
+ {
+
+ ContextActions.Remove(_overRideItemmenuitem);
+ if (_overRideItemmenuitem != null)
+ {
+ _overRideItemmenuitem.Clicked -= OverRide_Clicked;
+ _overRideItemmenuitem = null;
+ }
+ }
+
+
+ }
+ else if (obj.ChecklistStatus == CheckListStatus.Pending)
+ {
+ if (ContextActions.Count == 0)
+ {
+ ContextActions.Add(_overRideItemmenuitem);
+ }
+
+
+ }
+ else if (obj.ChecklistStatus == CheckListStatus.OverRide)
+ {
+ if (ContextActions.Count > 0)
+ {
+ ContextActions.Remove(_overRideItemmenuitem);
+ if (_overRideItemmenuitem != null)
+ {
+ _overRideItemmenuitem.Clicked -= OverRide_Clicked;
+ _overRideItemmenuitem = null;
+ }
+
+ }
+ }
+
+ }
+
+
+ }
+ catch (Exception ex)
+ {
+ throw ex;
+ }
+ }
+
+ }
+}