Skip to content

Instantly share code, notes, and snippets.

@clairernovotny
clairernovotny / CollectionViewSourceFactory.cs
Last active February 17, 2017 10:32
Pattern to use collection views in a portable class library with WPF and WinRT XAML. The issue is that while WPF and WinRT both have the CollectionView concepts, they're in different namespaces, so you can't use them in a PCL ViewModel. This wrapper allows you to wrap a collection view source and manipulate it in a PCL for navigation, etc. This …
// These classes would go in your PCL
public interface IWrappedCollectionView
{
bool MoveCurrentTo(object item);
bool MoveCurrentToPosition(int position);
bool IsCurrentAfterLast { get; }
bool MoveCurrentToFirst();
bool IsCurrentBeforeFirst { get; }
bool MoveCurrentToLast();
@clairernovotny
clairernovotny / Util.cs
Created October 15, 2012 22:55
TimeZone Conversion for NetCore - Obsolete - Use the WinRTTimeZones Nuget package for the latest
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
// OBSOLETE!!! Use the Nuget WinRTTimeZones package for the latest or
// get the code at https://github.com/onovotny/WinRTTimeZones
namespace TimeZoneUtils