* Move files to CollectionView folder for consistency with other platforms
Move SelectableItemsViewRenderer to Setup/Teardown pattern
Fix event handler naming
Use Is method for property changed check

* Rebase cleanup
This commit is contained in:
E.Z. Hart 2019-07-29 17:50:11 -06:00 коммит произвёл Samantha Houts
Родитель 58d4d6a33c
Коммит 880f368dda
12 изменённых файлов: 27 добавлений и 20 удалений

Просмотреть файл

@ -221,7 +221,7 @@
<file src="..\Xamarin.Forms.Platform.UAP\bin\$Configuration$\TabbedPageStyle.xbf" target="lib\uap10.0\Xamarin.Forms.Platform.UAP" />
<file src="..\Xamarin.Forms.Platform.UAP\bin\$Configuration$\FormsEmbeddedPageWrapper.xbf" target="lib\uap10.0\Xamarin.Forms.Platform.UAP" />
<file src="..\Xamarin.Forms.Platform.UAP\bin\$Configuration$\StepperControl.xbf" target="lib\uap10.0\Xamarin.Forms.Platform.UAP" />
<file src="..\Xamarin.Forms.Platform.UAP\bin\$Configuration$\Items\ItemsViewStyles.xbf" target="lib\uap10.0\Xamarin.Forms.Platform.UAP\Items" />
<file src="..\Xamarin.Forms.Platform.UAP\bin\$Configuration$\CollectionView\ItemsViewStyles.xbf" target="lib\uap10.0\Xamarin.Forms.Platform.UAP\Items" />
<file src="..\Xamarin.Forms.Platform.UAP\bin\$Configuration$\FormsCheckBoxStyle.xbf" target="lib\uap10.0\Xamarin.Forms.Platform.UAP" />
<!--Mac-->

Просмотреть файл

@ -183,9 +183,9 @@ namespace Xamarin.Forms.Platform.UWP
return horizontalListView;
}
void LayoutOnPropertyChanged(object sender, PropertyChangedEventArgs e)
void LayoutPropertyChanged(object sender, PropertyChangedEventArgs property)
{
if (e.PropertyName == GridItemsLayout.SpanProperty.PropertyName)
if (property.Is(GridItemsLayout.SpanProperty))
{
if (ListViewBase is FormsGridView formsGridView)
{
@ -194,7 +194,7 @@ namespace Xamarin.Forms.Platform.UWP
}
}
void SetUpNewElement(ItemsView newElement)
protected virtual void SetUpNewElement(ItemsView newElement)
{
if (newElement == null)
{
@ -206,7 +206,7 @@ namespace Xamarin.Forms.Platform.UWP
ListViewBase = SelectLayout(newElement.ItemsLayout);
_layout = newElement.ItemsLayout;
_layout.PropertyChanged += LayoutOnPropertyChanged;
_layout.PropertyChanged += LayoutPropertyChanged;
SetNativeControl(ListViewBase);
}
@ -220,7 +220,7 @@ namespace Xamarin.Forms.Platform.UWP
newElement.ScrollToRequested += ScrollToRequested;
}
void TearDownOldElement(ItemsView oldElement)
protected virtual void TearDownOldElement(ItemsView oldElement)
{
if (oldElement == null)
{
@ -230,7 +230,7 @@ namespace Xamarin.Forms.Platform.UWP
if (_layout != null)
{
// Stop tracking the old layout
_layout.PropertyChanged -= LayoutOnPropertyChanged;
_layout.PropertyChanged -= LayoutPropertyChanged;
_layout = null;
}

Просмотреть файл

@ -10,7 +10,7 @@ namespace Xamarin.Forms.Platform.UWP
{
SelectableItemsView _selectableItemsView;
protected override void OnElementChanged(ElementChangedEventArgs<CollectionView> args)
protected override void TearDownOldElement(ItemsView oldElement)
{
var oldListViewBase = ListViewBase;
if (oldListViewBase != null)
@ -19,13 +19,19 @@ namespace Xamarin.Forms.Platform.UWP
oldListViewBase.SelectionChanged -= OnNativeSelectionChanged;
}
if (args.OldElement != null)
if (_selectableItemsView != null)
{
args.OldElement.SelectionChanged -= OnSelectionChanged;
_selectableItemsView.SelectionChanged -= OnSelectionChanged;
}
base.OnElementChanged(args);
_selectableItemsView = args.NewElement;
base.TearDownOldElement(oldElement);
}
protected override void SetUpNewElement(ItemsView newElement)
{
base.SetUpNewElement(newElement);
_selectableItemsView = newElement as SelectableItemsView;
if (_selectableItemsView != null)
{
@ -47,6 +53,7 @@ namespace Xamarin.Forms.Platform.UWP
newListViewBase.SelectionChanged += OnNativeSelectionChanged;
}
UpdateNativeSelection();
}

Просмотреть файл

@ -14,7 +14,7 @@
<ResourceDictionary Source="MasterDetailControlStyle.xaml" />
<ResourceDictionary Source="TabbedPageStyle.xaml" />
<ResourceDictionary Source="SliderStyle.xaml" />
<ResourceDictionary Source="Items/ItemsViewStyles.xaml" />
<ResourceDictionary Source="CollectionView/ItemsViewStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
<uwp:CaseConverter x:Key="LowerConverter" ConvertToUpper="False" />

Просмотреть файл

@ -53,7 +53,7 @@
<Compile Include="AlertDialog.cs" />
<Compile Include="IDontGetFocus.cs" />
<Compile Include="FontImageSourceHandler.cs" />
<Compile Include="Items\ItemContentControl.cs" />
<Compile Include="CollectionView\ItemContentControl.cs" />
<Compile Include="FormsPivot.cs" />
<Compile Include="AlignmentExtensions.cs" />
<Compile Include="BrushHelpers.cs" />
@ -66,13 +66,13 @@
<Compile Include="ImageElementManager.cs" />
<Compile Include="InterceptVisualStateManager.cs" />
<Compile Include="HorizontalTextAlignmentConverter.cs" />
<Compile Include="Items\ObservableItemTemplateCollection.cs" />
<Compile Include="Items\TemplatedItemSourceFactory.cs" />
<Compile Include="CollectionView\ObservableItemTemplateCollection.cs" />
<Compile Include="CollectionView\TemplatedItemSourceFactory.cs" />
<Compile Include="ITitleIconProvider.cs" />
<Compile Include="ITitleViewProvider.cs" />
<Compile Include="Items\FormsGridView.cs" />
<Compile Include="Items\ItemTemplateEnumerator.cs" />
<Compile Include="Items\ItemTemplateContext.cs" />
<Compile Include="CollectionView\FormsGridView.cs" />
<Compile Include="CollectionView\ItemTemplateEnumerator.cs" />
<Compile Include="CollectionView\ItemTemplateContext.cs" />
<Compile Include="ITitleProvider.cs" />
<Compile Include="ITitleViewRendererController.cs" />
<Compile Include="IToolbarProvider.cs" />
@ -219,7 +219,7 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Items\ItemsViewStyles.xaml">
<Page Include="CollectionView\ItemsViewStyles.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>