This commit is contained in:
Beatriz Stollnitz 2019-08-05 20:54:24 -07:00
Родитель b5ffa79ee9
Коммит 7e684eb86d
86 изменённых файлов: 12565 добавлений и 0 удалений

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

@ -0,0 +1,46 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BindRadioButtonsToEnums", "BindRadioButtonsToEnums\BindRadioButtonsToEnums.csproj", "{CB1B1591-7A98-4497-A001-CA8A0E420408}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|ARM = Debug|ARM
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|ARM = Release|ARM
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{CB1B1591-7A98-4497-A001-CA8A0E420408}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CB1B1591-7A98-4497-A001-CA8A0E420408}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CB1B1591-7A98-4497-A001-CA8A0E420408}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{CB1B1591-7A98-4497-A001-CA8A0E420408}.Debug|ARM.ActiveCfg = Debug|ARM
{CB1B1591-7A98-4497-A001-CA8A0E420408}.Debug|ARM.Build.0 = Debug|ARM
{CB1B1591-7A98-4497-A001-CA8A0E420408}.Debug|ARM.Deploy.0 = Debug|ARM
{CB1B1591-7A98-4497-A001-CA8A0E420408}.Debug|x64.ActiveCfg = Debug|x64
{CB1B1591-7A98-4497-A001-CA8A0E420408}.Debug|x64.Build.0 = Debug|x64
{CB1B1591-7A98-4497-A001-CA8A0E420408}.Debug|x64.Deploy.0 = Debug|x64
{CB1B1591-7A98-4497-A001-CA8A0E420408}.Debug|x86.ActiveCfg = Debug|x86
{CB1B1591-7A98-4497-A001-CA8A0E420408}.Debug|x86.Build.0 = Debug|x86
{CB1B1591-7A98-4497-A001-CA8A0E420408}.Debug|x86.Deploy.0 = Debug|x86
{CB1B1591-7A98-4497-A001-CA8A0E420408}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CB1B1591-7A98-4497-A001-CA8A0E420408}.Release|Any CPU.Build.0 = Release|Any CPU
{CB1B1591-7A98-4497-A001-CA8A0E420408}.Release|Any CPU.Deploy.0 = Release|Any CPU
{CB1B1591-7A98-4497-A001-CA8A0E420408}.Release|ARM.ActiveCfg = Release|ARM
{CB1B1591-7A98-4497-A001-CA8A0E420408}.Release|ARM.Build.0 = Release|ARM
{CB1B1591-7A98-4497-A001-CA8A0E420408}.Release|ARM.Deploy.0 = Release|ARM
{CB1B1591-7A98-4497-A001-CA8A0E420408}.Release|x64.ActiveCfg = Release|x64
{CB1B1591-7A98-4497-A001-CA8A0E420408}.Release|x64.Build.0 = Release|x64
{CB1B1591-7A98-4497-A001-CA8A0E420408}.Release|x64.Deploy.0 = Release|x64
{CB1B1591-7A98-4497-A001-CA8A0E420408}.Release|x86.ActiveCfg = Release|x86
{CB1B1591-7A98-4497-A001-CA8A0E420408}.Release|x86.Build.0 = Release|x86
{CB1B1591-7A98-4497-A001-CA8A0E420408}.Release|x86.Deploy.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Двоичный файл не отображается.

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

@ -0,0 +1,21 @@
<Application
x:Class="BindRadioButtonsToEnums.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:BindRadioButtonsToEnums">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!--
Styles that define common aspects of the platform look and feel
Required by Visual Studio project and item templates
-->
<ResourceDictionary Source="Common/StandardStyles.xaml"/>
<ResourceDictionary Source="Styles/ControlStyles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

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

@ -0,0 +1,90 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=234227
namespace BindRadioButtonsToEnums
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
/// </summary>
sealed partial class App : Application
{
/// <summary>
/// Initializes the singleton application object. This is the first line of authored code
/// executed, and as such is the logical equivalent of main() or WinMain().
/// </summary>
public App()
{
this.InitializeComponent();
this.Suspending += OnSuspending;
}
/// <summary>
/// Invoked when the application is launched normally by the end user. Other entry points
/// will be used when the application is launched to open a specific file, to display
/// search results, and so forth.
/// </summary>
/// <param name="args">Details about the launch request and process.</param>
protected override void OnLaunched(LaunchActivatedEventArgs args)
{
Frame rootFrame = Window.Current.Content as Frame;
// Do not repeat app initialization when the Window already has content,
// just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate to the first page
rootFrame = new Frame();
if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
}
// Place the frame in the current Window
Window.Current.Content = rootFrame;
}
if (rootFrame.Content == null)
{
// When the navigation stack isn't restored navigate to the first page,
// configuring the new page by passing required information as a navigation
// parameter
if (!rootFrame.Navigate(typeof(MainPage), args.Arguments))
{
throw new Exception("Failed to create initial page");
}
}
// Ensure the current window is active
Window.Current.Activate();
}
/// <summary>
/// Invoked when application execution is being suspended. Application state is saved
/// without knowing whether the application will be terminated or resumed with the contents
/// of memory still intact.
/// </summary>
/// <param name="sender">The source of the suspend request.</param>
/// <param name="e">Details about the suspend request.</param>
private void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
//TODO: Save application state and stop any background activity
deferral.Complete();
}
}
}

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 801 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 329 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.1 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 429 B

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

@ -0,0 +1,164 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{CB1B1591-7A98-4497-A001-CA8A0E420408}</ProjectGuid>
<OutputType>AppContainerExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BindRadioButtonsToEnums</RootNamespace>
<AssemblyName>BindRadioButtonsToEnums</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<PackageCertificateKeyFile>BindRadioButtonsToEnums_TemporaryKey.pfx</PackageCertificateKeyFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\ARM\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
<OutputPath>bin\ARM\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<!-- A reference to the entire .Net Framework and Windows SDK are automatically included -->
</ItemGroup>
<ItemGroup>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="Common\BindableBase.cs" />
<Compile Include="Converters\EnumToBooleanConverter.cs" />
<Compile Include="Converters\TransportationModeToBooleanConverter.cs" />
<Compile Include="Helpers\DelegateCommand.cs" />
<Compile Include="ViewModels\JourneyViewModel1.cs" />
<Compile Include="ViewModels\JourneyViewModel2.cs" />
<Compile Include="MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Models\TransportationMode.cs" />
<Compile Include="ViewModels\JourneyViewModel3.cs" />
</ItemGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
<None Include="BindRadioButtonsToEnums_TemporaryKey.pfx" />
</ItemGroup>
<ItemGroup>
<Content Include="Assets\Logo.png" />
<Content Include="Assets\SmallLogo.png" />
<Content Include="Assets\SplashScreen.png" />
<Content Include="Assets\StoreLogo.png" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Page Include="Common\StandardStyles.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Styles\ControlStyles.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Page>
<Page Include="MainPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '11.0' ">
<VisualStudioVersion>11.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

Двоичный файл не отображается.

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

@ -0,0 +1,55 @@
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using Windows.UI.Xaml.Data;
namespace BindRadioButtonsToEnums.Common
{
/// <summary>
/// Implementation of <see cref="INotifyPropertyChanged"/> to simplify models.
/// </summary>
[Windows.Foundation.Metadata.WebHostHidden]
public abstract class BindableBase : INotifyPropertyChanged
{
/// <summary>
/// Multicast event for property change notifications.
/// </summary>
public event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// Checks if a property already matches a desired value. Sets the property and
/// notifies listeners only when necessary.
/// </summary>
/// <typeparam name="T">Type of the property.</typeparam>
/// <param name="storage">Reference to a property with both getter and setter.</param>
/// <param name="value">Desired value for the property.</param>
/// <param name="propertyName">Name of the property used to notify listeners. This
/// value is optional and can be provided automatically when invoked from compilers that
/// support CallerMemberName.</param>
/// <returns>True if the value was changed, false if the existing value matched the
/// desired value.</returns>
protected bool SetProperty<T>(ref T storage, T value, [CallerMemberName] String propertyName = null)
{
if (object.Equals(storage, value)) return false;
storage = value;
this.OnPropertyChanged(propertyName);
return true;
}
/// <summary>
/// Notifies listeners that a property value has changed.
/// </summary>
/// <param name="propertyName">Name of the property used to notify listeners. This
/// value is optional and can be provided automatically when invoked from compilers
/// that support <see cref="CallerMemberNameAttribute"/>.</param>
protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
var eventHandler = this.PropertyChanged;
if (eventHandler != null)
{
eventHandler(this, new PropertyChangedEventArgs(propertyName));
}
}
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Data;
namespace BindRadioButtonsToEnums.Converters
{
public class EnumToBooleanConverter<TEnum> : IValueConverter where TEnum : struct
{
public object Convert(object value, Type targetType, object parameter, string language)
{
// Convert parameter from string to enum if needed.
TEnum enumValue;
if (parameter is string && Enum.TryParse<TEnum>((string)parameter, true, out enumValue))
{
parameter = enumValue;
}
// Return true if value matches parameter.
return Object.Equals(value, parameter);
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
// If value is true, then return the enum value corresponding to parameter.
if (Object.Equals(value, true))
{
// Convert parameter from string to enum if needed.
TEnum enumValue;
if (parameter is string && Enum.TryParse<TEnum>((string)parameter, true, out enumValue))
{
parameter = enumValue;
}
return parameter;
}
// Otherwise, return UnsetValue, which is ignored by bindings.
return DependencyProperty.UnsetValue;
}
}
}

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

@ -0,0 +1,11 @@
using BindRadioButtonsToEnums.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BindRadioButtonsToEnums.Converters
{
public class TransportationModeToBooleanConverter : EnumToBooleanConverter<TransportationMode> { }
}

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

@ -0,0 +1,29 @@
using System;
using System.Windows.Input;
namespace BindRadioButtonsToEnums.Helpers
{
public sealed class DelegateCommand : ICommand
{
private Action action;
public DelegateCommand(Action action)
{
this.action = action;
}
public bool CanExecute(object parameter)
{
return true;
}
#pragma warning disable 67
public event EventHandler CanExecuteChanged;
#pragma warning restore 67
public void Execute(object parameter)
{
this.action();
}
}
}

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

@ -0,0 +1,168 @@
<Page
x:Class="BindRadioButtonsToEnums.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:BindRadioButtonsToEnums"
xmlns:viewmodels="using:BindRadioButtonsToEnums.ViewModels"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:converters="using:BindRadioButtonsToEnums.Converters"
mc:Ignorable="d">
<Page.Resources>
<converters:TransportationModeToBooleanConverter x:Key="transportationModeToBooleanConverter"/>
<Style x:Key="SampleTitleTextStyle"
TargetType="TextBlock"
BasedOn="{StaticResource SubheaderTextStyle}">
<Setter Property="Margin" Value="0,60,0,20"/>
</Style>
<Style x:Key="SummaryTextStyle"
TargetType="TextBlock"
BasedOn="{StaticResource BodyTextStyle}">
<Setter Property="Margin" Value="0,20,0,20"/>
</Style>
</Page.Resources>
<Grid Style="{StaticResource LayoutRootStyle}">
<Grid.RowDefinitions>
<RowDefinition Height="140"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Back button and page title -->
<Grid>
<TextBlock Text="Binding Radio Buttons to Enums"
Style="{StaticResource PageHeaderTextStyle}"
Margin="120,0,0,0"/>
</Grid>
<!-- content -->
<Grid Grid.Row="1" Margin="120,0,120,0">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<!-- sample 1 -->
<StackPanel x:Name="sample1">
<StackPanel.DataContext>
<viewmodels:JourneyViewModel1/>
</StackPanel.DataContext>
<TextBlock Text="Sample 1"
Style="{StaticResource SampleTitleTextStyle}"/>
<ListBox ItemsSource="{Binding Path=AvailableTransportationModes}"
SelectedItem="{Binding SelectedTransportationMode, Mode=TwoWay}"
ItemContainerStyle="{StaticResource RadioButtonListBoxItemStyle}"
Style="{StaticResource RadioButtonListBoxStyle}"/>
<TextBlock Style="{StaticResource SummaryTextStyle}">
<Run>Selected value:</Run>
<Run FontWeight="SemiBold"
Text="{Binding Path=SelectedTransportationMode}"/>
<LineBreak/>
<Run>Estimated duration:</Run>
<Run FontWeight="SemiBold"
Text="{Binding Path=EstimatedDuration}"/>
</TextBlock>
<Button Content="Go by bicycle" Command="{Binding GoByBicycleCommand}"/>
</StackPanel>
<!-- sample 2 -->
<StackPanel Grid.Column="1">
<StackPanel.DataContext>
<viewmodels:JourneyViewModel2/>
</StackPanel.DataContext>
<TextBlock Text="Sample 2" Style="{StaticResource SampleTitleTextStyle}"/>
<StackPanel>
<RadioButton Content="Car" GroupName="Group2"
IsChecked="{Binding IsCar, Mode=TwoWay}"/>
<RadioButton Content="Bicycle" GroupName="Group2"
IsChecked="{Binding IsBicycle, Mode=TwoWay}"/>
<RadioButton Content="Train" GroupName="Group2"
IsChecked="{Binding IsTrain, Mode=TwoWay}"/>
<RadioButton Content="Boat" GroupName="Group2"
IsChecked="{Binding IsBoat, Mode=TwoWay}"/>
<RadioButton Content="Rickshaw" GroupName="Group2"
IsChecked="{Binding IsRickshaw, Mode=TwoWay}"/>
<RadioButton Content="Hovercraft" GroupName="Group2"
IsChecked="{Binding IsHovercraft, Mode=TwoWay}"/>
</StackPanel>
<TextBlock Style="{StaticResource SummaryTextStyle}">
<Run>Selected value:</Run>
<Run FontWeight="SemiBold"
Text="{Binding Path=SelectedTransportationMode}"/>
<LineBreak/>
<Run>Estimated duration:</Run>
<Run FontWeight="SemiBold"
Text="{Binding Path=EstimatedDuration}"/>
</TextBlock>
<Button Content="Go by bicycle" Command="{Binding GoByBicycleCommand}"/>
</StackPanel>
<!-- sample 3 -->
<StackPanel Grid.Column="2">
<StackPanel.DataContext>
<viewmodels:JourneyViewModel3/>
</StackPanel.DataContext>
<TextBlock Text="Sample 3" Style="{StaticResource SampleTitleTextStyle}"/>
<StackPanel>
<RadioButton Content="Car" GroupName="Group3"
IsChecked="{Binding
Path=SelectedTransportationMode,
Converter={StaticResource transportationModeToBooleanConverter},
ConverterParameter=Car,
Mode=TwoWay}"/>
<RadioButton Content="Bicycle" GroupName="Group3"
IsChecked="{Binding
Path=SelectedTransportationMode,
Converter={StaticResource transportationModeToBooleanConverter},
ConverterParameter=Bicycle,
Mode=TwoWay}"/>
<RadioButton Content="Train" GroupName="Group3"
IsChecked="{Binding
Path=SelectedTransportationMode,
Converter={StaticResource transportationModeToBooleanConverter},
ConverterParameter=Train,
Mode=TwoWay}"/>
<RadioButton Content="Boat" GroupName="Group3"
IsChecked="{Binding
Path=SelectedTransportationMode,
Converter={StaticResource transportationModeToBooleanConverter},
ConverterParameter=Boat,
Mode=TwoWay}"/>
<RadioButton Content="Rickshaw" GroupName="Group3"
IsChecked="{Binding
Path=SelectedTransportationMode,
Converter={StaticResource transportationModeToBooleanConverter},
ConverterParameter=Rickshaw,
Mode=TwoWay}"/>
<RadioButton Content="Hovercraft" GroupName="Group3"
IsChecked="{Binding
Path=SelectedTransportationMode,
Converter={StaticResource transportationModeToBooleanConverter},
ConverterParameter=Hovercraft,
Mode=TwoWay}"/>
</StackPanel>
<TextBlock Style="{StaticResource SummaryTextStyle}">
<Run>Selected value:</Run>
<Run FontWeight="SemiBold"
Text="{Binding Path=SelectedTransportationMode}"/>
<LineBreak/>
<Run>Estimated duration:</Run>
<Run FontWeight="SemiBold"
Text="{Binding Path=EstimatedDuration}"/>
</TextBlock>
<Button Content="Go by bicycle" Command="{Binding GoByBicycleCommand}"/>
</StackPanel>
<!-- sample 4 -->
<StackPanel Grid.Column="3">
</StackPanel>
</Grid>
</Grid>
</Page>

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

@ -0,0 +1,39 @@
using BindRadioButtonsToEnums.ViewModels;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace BindRadioButtonsToEnums
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
}
/// <summary>
/// Invoked when this page is about to be displayed in a Frame.
/// </summary>
/// <param name="e">Event data that describes how this page was reached. The Parameter
/// property is typically used to configure the page.</param>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
}
}
}

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

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BindRadioButtonsToEnums.Models
{
public enum TransportationMode
{
Car,
Bicycle,
Train,
Boat,
Rickshaw,
Hovercraft
}
}

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

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest">
<Identity Name="9970d221-97e2-4b67-a79d-51565f5a3cd4"
Publisher="CN=Beatriz"
Version="1.0.0.0" />
<Properties>
<DisplayName>BindRadioButtonsToEnums</DisplayName>
<PublisherDisplayName>Beatriz</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Prerequisites>
<OSMinVersion>6.2.1</OSMinVersion>
<OSMaxVersionTested>6.2.1</OSMaxVersionTested>
</Prerequisites>
<Resources>
<Resource Language="x-generate"/>
</Resources>
<Applications>
<Application Id="App"
Executable="$targetnametoken$.exe"
EntryPoint="BindRadioButtonsToEnums.App">
<VisualElements
DisplayName="BindRadioButtonsToEnums"
Logo="Assets\Logo.png"
SmallLogo="Assets\SmallLogo.png"
Description="BindRadioButtonsToEnums"
ForegroundText="light"
BackgroundColor="#464646">
<DefaultTile ShowName="allLogos" />
<SplashScreen Image="Assets\SplashScreen.png" />
</VisualElements>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
</Capabilities>
</Package>

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

@ -0,0 +1,29 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("BindRadioButtonsToEnums")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BindRadioButtonsToEnums")]
[assembly: AssemblyCopyright("Copyright © 2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ComVisible(false)]

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

@ -0,0 +1,264 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:BindRadioButtonsToEnums">
<Style TargetType="ListBox" x:Key="RadioButtonListBoxStyle">
<Setter Property="Foreground" Value="{StaticResource ListBoxForegroundThemeBrush}" />
<Setter Property="Background" Value="{x:Null}" />
<Setter Property="BorderBrush" Value="{StaticResource ListBoxBorderThemeBrush}" />
<Setter Property="BorderThickness" Value="{StaticResource ListBoxBorderThemeThickness}" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="ScrollViewer.HorizontalScrollMode" Value="Disabled" />
<Setter Property="ScrollViewer.IsHorizontalRailEnabled" Value="True" />
<Setter Property="ScrollViewer.VerticalScrollMode" Value="Enabled" />
<Setter Property="ScrollViewer.IsVerticalRailEnabled" Value="True" />
<Setter Property="ScrollViewer.ZoomMode" Value="Disabled" />
<Setter Property="ScrollViewer.IsDeferredScrollingEnabled" Value="False" />
<Setter Property="ScrollViewer.BringIntoViewOnFocusChange" Value="True" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="TabNavigation" Value="Once" />
<Setter Property="FontFamily" Value="{StaticResource ContentControlThemeFontFamily}" />
<Setter Property="FontSize" Value="{StaticResource ControlContentThemeFontSize}" />
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBox">
<Border x:Name="LayoutRoot"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot"
Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="Transparent" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot"
Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ListBoxDisabledForegroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Focused">
</VisualState>
<VisualState x:Name="Unfocused"/>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<ScrollViewer x:Name="ScrollViewer"
Padding="{TemplateBinding Padding}"
TabNavigation="{TemplateBinding TabNavigation}"
HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}"
IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}"
ZoomMode="{TemplateBinding ScrollViewer.ZoomMode}"
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
BringIntoViewOnFocusChange="{TemplateBinding ScrollViewer.BringIntoViewOnFocusChange}">
<ItemsPresenter />
</ScrollViewer>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="ListBoxItem" x:Key="RadioButtonListBoxItemStyle">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{StaticResource RadioButtonContentForegroundThemeBrush}"/>
<Setter Property="Padding" Value="1,4,0,0" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="VerticalContentAlignment" Value="Top" />
<Setter Property="FontFamily" Value="{StaticResource ContentControlThemeFontFamily}" />
<Setter Property="FontSize" Value="{StaticResource ControlContentThemeFontSize}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundEllipse"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonPointerOverBackgroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundEllipse"
Storyboard.TargetProperty="Stroke">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonPointerOverBorderThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonPointerOverForegroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundEllipse"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonPressedBackgroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundEllipse"
Storyboard.TargetProperty="Stroke">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonPressedBorderThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonPressedForegroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundEllipse"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonDisabledBackgroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundEllipse"
Storyboard.TargetProperty="Stroke">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonDisabledBorderThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonDisabledForegroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter"
Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonContentDisabledForegroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="SelectionStates">
<VisualState x:Name="Unselected" />
<VisualState x:Name="Selected">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
</Storyboard>
</VisualState>
<VisualState x:Name="SelectedUnfocused">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
</Storyboard>
</VisualState>
<VisualState x:Name="SelectedDisabled">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
</Storyboard>
</VisualState>
<VisualState x:Name="SelectedPointerOver">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
</Storyboard>
</VisualState>
<VisualState x:Name="SelectedPressed">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Focused">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="FocusVisualWhite"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
<DoubleAnimation Storyboard.TargetName="FocusVisualBlack"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
</Storyboard>
</VisualState>
<VisualState x:Name="Unfocused" />
<VisualState x:Name="PointerFocused" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="29" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid VerticalAlignment="Top">
<Ellipse x:Name="BackgroundEllipse"
Width="23"
Height="23"
UseLayoutRounding="False"
Fill="{StaticResource RadioButtonBackgroundThemeBrush}"
Stroke="{StaticResource RadioButtonBorderThemeBrush}"
StrokeThickness="{StaticResource RadioButtonBorderThemeThickness}" />
<Ellipse x:Name="CheckGlyph"
Width="13"
Height="13"
UseLayoutRounding="False"
Opacity="0"
Fill="{StaticResource RadioButtonForegroundThemeBrush}" />
<Rectangle x:Name="FocusVisualWhite"
Stroke="{StaticResource FocusVisualWhiteStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
StrokeDashOffset="1.5"
Width="29"
Height="29" />
<Rectangle x:Name="FocusVisualBlack"
Stroke="{StaticResource FocusVisualBlackStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
StrokeDashOffset="0.5"
Width="29"
Height="29" />
</Grid>
<ContentPresenter x:Name="ContentPresenter"
Content="{TemplateBinding Content}"
ContentTransitions="{TemplateBinding ContentTransitions}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Grid.Column="1" />
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

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

@ -0,0 +1,66 @@
using BindRadioButtonsToEnums.Common;
using BindRadioButtonsToEnums.Helpers;
using BindRadioButtonsToEnums.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
namespace BindRadioButtonsToEnums.ViewModels
{
public sealed class JourneyViewModel1 : BindableBase
{
public JourneyViewModel1()
{
// If the order of the enum in the code is the same as you want in the UI.
this.AvailableTransportationModes = Enum.GetValues(typeof(TransportationMode)).OfType<TransportationMode>().ToArray();
// If you want the order of the items to be different in the UI.
//this.AvailableTransportationModes = new TransportationMode[] {
// TransportationMode.Train,
// TransportationMode.Car,
// TransportationMode.Rickshaw,
// TransportationMode.Hovercraft,
// TransportationMode.Bicycle,
// TransportationMode.Boat
//};
}
public IEnumerable<TransportationMode> AvailableTransportationModes
{
get;
private set;
}
private TransportationMode selectedTransportationMode = TransportationMode.Rickshaw;
public TransportationMode SelectedTransportationMode
{
get { return this.selectedTransportationMode; }
set
{
if (this.SetProperty(ref this.selectedTransportationMode, value))
{
this.OnPropertyChanged("EstimatedDuration");
}
}
}
public string EstimatedDuration
{
get { return string.Format("{0} minutes", 13 + 17 * (int)SelectedTransportationMode); }
}
public ICommand GoByBicycleCommand
{
get
{
return new DelegateCommand(delegate
{
this.SelectedTransportationMode = TransportationMode.Bicycle;
});
}
}
}
}

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

@ -0,0 +1,86 @@
using BindRadioButtonsToEnums.Common;
using BindRadioButtonsToEnums.Helpers;
using BindRadioButtonsToEnums.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
namespace BindRadioButtonsToEnums.ViewModels
{
public sealed class JourneyViewModel2 : BindableBase
{
private TransportationMode selectedTransportationMode = TransportationMode.Rickshaw;
public TransportationMode SelectedTransportationMode
{
get { return this.selectedTransportationMode; }
set
{
if (this.SetProperty(ref this.selectedTransportationMode, value))
{
this.OnPropertyChanged("IsCar");
this.OnPropertyChanged("IsBicycle");
this.OnPropertyChanged("IsTrain");
this.OnPropertyChanged("IsBoat");
this.OnPropertyChanged("IsRickshaw");
this.OnPropertyChanged("IsHovercraft");
this.OnPropertyChanged("EstimatedDuration");
}
}
}
public bool IsCar
{
get { return this.SelectedTransportationMode == TransportationMode.Car; }
set { if (value) this.SelectedTransportationMode = TransportationMode.Car; }
}
public bool IsBicycle
{
get { return this.SelectedTransportationMode == TransportationMode.Bicycle; }
set { if (value) this.SelectedTransportationMode = TransportationMode.Bicycle; }
}
public bool IsTrain
{
get { return this.SelectedTransportationMode == TransportationMode.Train; }
set { if (value) this.SelectedTransportationMode = TransportationMode.Train; }
}
public bool IsBoat
{
get { return this.SelectedTransportationMode == TransportationMode.Boat; }
set { if (value) this.SelectedTransportationMode = TransportationMode.Boat; }
}
public bool IsRickshaw
{
get { return this.SelectedTransportationMode == TransportationMode.Rickshaw; }
set { if (value) this.SelectedTransportationMode = TransportationMode.Rickshaw; }
}
public bool IsHovercraft
{
get { return this.SelectedTransportationMode == TransportationMode.Hovercraft; }
set { if (value) this.SelectedTransportationMode = TransportationMode.Hovercraft; }
}
public string EstimatedDuration
{
get { return string.Format("{0} minutes", 13 + 17 * (int)SelectedTransportationMode); }
}
public ICommand GoByBicycleCommand
{
get
{
return new DelegateCommand(delegate
{
this.SelectedTransportationMode = TransportationMode.Bicycle;
});
}
}
}
}

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

@ -0,0 +1,39 @@
using BindRadioButtonsToEnums.Common;
using BindRadioButtonsToEnums.Helpers;
using BindRadioButtonsToEnums.Models;
using System.Windows.Input;
namespace BindRadioButtonsToEnums.ViewModels
{
public sealed class JourneyViewModel3 : BindableBase
{
private TransportationMode selectedTransportationMode = TransportationMode.Rickshaw;
public TransportationMode SelectedTransportationMode
{
get { return this.selectedTransportationMode; }
set
{
if (this.SetProperty(ref this.selectedTransportationMode, value))
{
this.OnPropertyChanged("EstimatedDuration");
}
}
}
public string EstimatedDuration
{
get { return string.Format("{0} minutes", 13 + 17 * (int)SelectedTransportationMode); }
}
public ICommand GoByBicycleCommand
{
get
{
return new DelegateCommand(delegate
{
this.SelectedTransportationMode = TransportationMode.Bicycle;
});
}
}
}
}

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

@ -0,0 +1,22 @@
<Application
x:Class="BindRadioButtonsToEnums.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:BindRadioButtonsToEnums">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!--
Styles that define common aspects of the platform look and feel
Required by Visual Studio project and item templates
-->
<ResourceDictionary Source="Common/StandardStyles.xaml"/>
<ResourceDictionary Source="Styles/ControlStyles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

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

@ -0,0 +1,22 @@
<Application
x:Class="BindRadioButtonsToEnums.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:BindRadioButtonsToEnums">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!--
Styles that define common aspects of the platform look and feel
Required by Visual Studio project and item templates
-->
<ResourceDictionary Source="Common/StandardStyles.xaml"/>
<ResourceDictionary Source="Styles/ControlStyles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

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

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:build="http://schemas.microsoft.com/developer/appx/2012/build" IgnorableNamespaces="build">
<!--
THIS PACKAGE MANIFEST FILE IS GENERATED BY THE BUILD PROCESS.
Changes to this file will be lost when it is regenerated. To correct errors in this file, edit the source .appxmanifest file.
For more information on package manifest files, see http://go.microsoft.com/fwlink/?LinkID=241727
-->
<Identity Name="9970d221-97e2-4b67-a79d-51565f5a3cd4" Publisher="CN=Beatriz" Version="1.0.0.0" ProcessorArchitecture="neutral" />
<Properties>
<DisplayName>BindRadioButtonsToEnums</DisplayName>
<PublisherDisplayName>Beatriz</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Prerequisites>
<OSMinVersion>6.2.1</OSMinVersion>
<OSMaxVersionTested>6.2.1</OSMaxVersionTested>
</Prerequisites>
<Resources>
<Resource Language="EN-US" />
</Resources>
<Applications>
<Application Id="App" Executable="BindRadioButtonsToEnums.exe" EntryPoint="BindRadioButtonsToEnums.App">
<VisualElements DisplayName="BindRadioButtonsToEnums" Logo="Assets\Logo.png" SmallLogo="Assets\SmallLogo.png" Description="BindRadioButtonsToEnums" ForegroundText="light" BackgroundColor="#464646">
<DefaultTile ShowName="allLogos" />
<SplashScreen Image="Assets\SplashScreen.png" />
</VisualElements>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
</Capabilities>
<build:Metadata>
<build:Item Name="TargetFrameworkMoniker" Value=".NETCore,Version=v4.5" />
<build:Item Name="VisualStudio" Version="11.0" />
<build:Item Name="OperatingSystem" Version="6.2.8520.0 (fbl_eeap.120722-1632)" />
<build:Item Name="Microsoft.Build.AppxPackage.dll" Version="11.0.50722.1" />
<build:Item Name="Microsoft.Windows.UI.Xaml.Build.Tasks.dll" Version="11.0.50722.1" />
<build:Item Name="MakePri.exe" Version="6.2.8521.0 (win8_rtm.120720-1844)" />
</build:Metadata>
</Package>

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 801 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 329 B

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.1 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 429 B

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -0,0 +1,169 @@
<Page
x:Class="BindRadioButtonsToEnums.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:BindRadioButtonsToEnums"
xmlns:viewmodels="using:BindRadioButtonsToEnums.ViewModels"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:converters="using:BindRadioButtonsToEnums.Converters"
mc:Ignorable="d">
<Page.Resources>
<converters:TransportationModeToBooleanConverter x:Key="transportationModeToBooleanConverter"/>
<Style x:Key="SampleTitleTextStyle"
TargetType="TextBlock"
BasedOn="{StaticResource SubheaderTextStyle}">
<Setter Property="Margin" Value="0,60,0,20"/>
</Style>
<Style x:Key="SummaryTextStyle"
TargetType="TextBlock"
BasedOn="{StaticResource BodyTextStyle}">
<Setter Property="Margin" Value="0,20,0,20"/>
</Style>
</Page.Resources>
<Grid Style="{StaticResource LayoutRootStyle}">
<Grid.RowDefinitions>
<RowDefinition Height="140"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Back button and page title -->
<Grid>
<TextBlock Text="Binding Radio Buttons to Enums"
Style="{StaticResource PageHeaderTextStyle}"
Margin="120,0,0,0"/>
</Grid>
<!-- content -->
<Grid Grid.Row="1" Margin="120,0,120,0">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<!-- sample 1 -->
<StackPanel x:Name="sample1">
<StackPanel.DataContext>
<viewmodels:JourneyViewModel1/>
</StackPanel.DataContext>
<TextBlock Text="Sample 1"
Style="{StaticResource SampleTitleTextStyle}"/>
<ListBox ItemsSource="{Binding Path=AvailableTransportationModes}"
SelectedItem="{Binding SelectedTransportationMode, Mode=TwoWay}"
ItemContainerStyle="{StaticResource RadioButtonListBoxItemStyle}"
Style="{StaticResource RadioButtonListBoxStyle}"/>
<TextBlock Style="{StaticResource SummaryTextStyle}">
<Run>Selected value:</Run>
<Run FontWeight="SemiBold"
Text="{Binding Path=SelectedTransportationMode}"/>
<LineBreak/>
<Run>Estimated duration:</Run>
<Run FontWeight="SemiBold"
Text="{Binding Path=EstimatedDuration}"/>
</TextBlock>
<Button Content="Go by bicycle" Command="{Binding GoByBicycleCommand}"/>
</StackPanel>
<!-- sample 2 -->
<StackPanel Grid.Column="1">
<StackPanel.DataContext>
<viewmodels:JourneyViewModel2/>
</StackPanel.DataContext>
<TextBlock Text="Sample 2" Style="{StaticResource SampleTitleTextStyle}"/>
<StackPanel>
<RadioButton Content="Car" GroupName="Group2"
IsChecked="{Binding IsCar, Mode=TwoWay}"/>
<RadioButton Content="Bicycle" GroupName="Group2"
IsChecked="{Binding IsBicycle, Mode=TwoWay}"/>
<RadioButton Content="Train" GroupName="Group2"
IsChecked="{Binding IsTrain, Mode=TwoWay}"/>
<RadioButton Content="Boat" GroupName="Group2"
IsChecked="{Binding IsBoat, Mode=TwoWay}"/>
<RadioButton Content="Rickshaw" GroupName="Group2"
IsChecked="{Binding IsRickshaw, Mode=TwoWay}"/>
<RadioButton Content="Hovercraft" GroupName="Group2"
IsChecked="{Binding IsHovercraft, Mode=TwoWay}"/>
</StackPanel>
<TextBlock Style="{StaticResource SummaryTextStyle}">
<Run>Selected value:</Run>
<Run FontWeight="SemiBold"
Text="{Binding Path=SelectedTransportationMode}"/>
<LineBreak/>
<Run>Estimated duration:</Run>
<Run FontWeight="SemiBold"
Text="{Binding Path=EstimatedDuration}"/>
</TextBlock>
<Button Content="Go by bicycle" Command="{Binding GoByBicycleCommand}"/>
</StackPanel>
<!-- sample 3 -->
<StackPanel Grid.Column="2">
<StackPanel.DataContext>
<viewmodels:JourneyViewModel3/>
</StackPanel.DataContext>
<TextBlock Text="Sample 3" Style="{StaticResource SampleTitleTextStyle}"/>
<StackPanel>
<RadioButton Content="Car" GroupName="Group3"
IsChecked="{Binding
Path=SelectedTransportationMode,
Converter={StaticResource transportationModeToBooleanConverter},
ConverterParameter=Car,
Mode=TwoWay}"/>
<RadioButton Content="Bicycle" GroupName="Group3"
IsChecked="{Binding
Path=SelectedTransportationMode,
Converter={StaticResource transportationModeToBooleanConverter},
ConverterParameter=Bicycle,
Mode=TwoWay}"/>
<RadioButton Content="Train" GroupName="Group3"
IsChecked="{Binding
Path=SelectedTransportationMode,
Converter={StaticResource transportationModeToBooleanConverter},
ConverterParameter=Train,
Mode=TwoWay}"/>
<RadioButton Content="Boat" GroupName="Group3"
IsChecked="{Binding
Path=SelectedTransportationMode,
Converter={StaticResource transportationModeToBooleanConverter},
ConverterParameter=Boat,
Mode=TwoWay}"/>
<RadioButton Content="Rickshaw" GroupName="Group3"
IsChecked="{Binding
Path=SelectedTransportationMode,
Converter={StaticResource transportationModeToBooleanConverter},
ConverterParameter=Rickshaw,
Mode=TwoWay}"/>
<RadioButton Content="Hovercraft" GroupName="Group3"
IsChecked="{Binding
Path=SelectedTransportationMode,
Converter={StaticResource transportationModeToBooleanConverter},
ConverterParameter=Hovercraft,
Mode=TwoWay}"/>
</StackPanel>
<TextBlock Style="{StaticResource SummaryTextStyle}">
<Run>Selected value:</Run>
<Run FontWeight="SemiBold"
Text="{Binding Path=SelectedTransportationMode}"/>
<LineBreak/>
<Run>Estimated duration:</Run>
<Run FontWeight="SemiBold"
Text="{Binding Path=EstimatedDuration}"/>
</TextBlock>
<Button Content="Go by bicycle" Command="{Binding GoByBicycleCommand}"/>
</StackPanel>
<!-- sample 4 -->
<StackPanel Grid.Column="3">
</StackPanel>
</Grid>
</Grid>
</Page>

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

@ -0,0 +1,265 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:BindRadioButtonsToEnums">
<Style TargetType="ListBox" x:Key="RadioButtonListBoxStyle">
<Setter Property="Foreground" Value="{StaticResource ListBoxForegroundThemeBrush}" />
<Setter Property="Background" Value="{x:Null}" />
<Setter Property="BorderBrush" Value="{StaticResource ListBoxBorderThemeBrush}" />
<Setter Property="BorderThickness" Value="{StaticResource ListBoxBorderThemeThickness}" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="ScrollViewer.HorizontalScrollMode" Value="Disabled" />
<Setter Property="ScrollViewer.IsHorizontalRailEnabled" Value="True" />
<Setter Property="ScrollViewer.VerticalScrollMode" Value="Enabled" />
<Setter Property="ScrollViewer.IsVerticalRailEnabled" Value="True" />
<Setter Property="ScrollViewer.ZoomMode" Value="Disabled" />
<Setter Property="ScrollViewer.IsDeferredScrollingEnabled" Value="False" />
<Setter Property="ScrollViewer.BringIntoViewOnFocusChange" Value="True" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="TabNavigation" Value="Once" />
<Setter Property="FontFamily" Value="{StaticResource ContentControlThemeFontFamily}" />
<Setter Property="FontSize" Value="{StaticResource ControlContentThemeFontSize}" />
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBox">
<Border x:Name="LayoutRoot"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot"
Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="Transparent" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot"
Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ListBoxDisabledForegroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Focused">
</VisualState>
<VisualState x:Name="Unfocused"/>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<ScrollViewer x:Name="ScrollViewer"
Padding="{TemplateBinding Padding}"
TabNavigation="{TemplateBinding TabNavigation}"
HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}"
IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}"
ZoomMode="{TemplateBinding ScrollViewer.ZoomMode}"
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
BringIntoViewOnFocusChange="{TemplateBinding ScrollViewer.BringIntoViewOnFocusChange}">
<ItemsPresenter />
</ScrollViewer>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="ListBoxItem" x:Key="RadioButtonListBoxItemStyle">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{StaticResource RadioButtonContentForegroundThemeBrush}"/>
<Setter Property="Padding" Value="1,4,0,0" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="VerticalContentAlignment" Value="Top" />
<Setter Property="FontFamily" Value="{StaticResource ContentControlThemeFontFamily}" />
<Setter Property="FontSize" Value="{StaticResource ControlContentThemeFontSize}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundEllipse"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonPointerOverBackgroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundEllipse"
Storyboard.TargetProperty="Stroke">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonPointerOverBorderThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonPointerOverForegroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundEllipse"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonPressedBackgroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundEllipse"
Storyboard.TargetProperty="Stroke">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonPressedBorderThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonPressedForegroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundEllipse"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonDisabledBackgroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundEllipse"
Storyboard.TargetProperty="Stroke">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonDisabledBorderThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonDisabledForegroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter"
Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonContentDisabledForegroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="SelectionStates">
<VisualState x:Name="Unselected" />
<VisualState x:Name="Selected">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
</Storyboard>
</VisualState>
<VisualState x:Name="SelectedUnfocused">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
</Storyboard>
</VisualState>
<VisualState x:Name="SelectedDisabled">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
</Storyboard>
</VisualState>
<VisualState x:Name="SelectedPointerOver">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
</Storyboard>
</VisualState>
<VisualState x:Name="SelectedPressed">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Focused">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="FocusVisualWhite"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
<DoubleAnimation Storyboard.TargetName="FocusVisualBlack"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
</Storyboard>
</VisualState>
<VisualState x:Name="Unfocused" />
<VisualState x:Name="PointerFocused" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="29" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid VerticalAlignment="Top">
<Ellipse x:Name="BackgroundEllipse"
Width="23"
Height="23"
UseLayoutRounding="False"
Fill="{StaticResource RadioButtonBackgroundThemeBrush}"
Stroke="{StaticResource RadioButtonBorderThemeBrush}"
StrokeThickness="{StaticResource RadioButtonBorderThemeThickness}" />
<Ellipse x:Name="CheckGlyph"
Width="13"
Height="13"
UseLayoutRounding="False"
Opacity="0"
Fill="{StaticResource RadioButtonForegroundThemeBrush}" />
<Rectangle x:Name="FocusVisualWhite"
Stroke="{StaticResource FocusVisualWhiteStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
StrokeDashOffset="1.5"
Width="29"
Height="29" />
<Rectangle x:Name="FocusVisualBlack"
Stroke="{StaticResource FocusVisualBlackStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
StrokeDashOffset="0.5"
Width="29"
Height="29" />
</Grid>
<ContentPresenter x:Name="ContentPresenter"
Content="{TemplateBinding Content}"
ContentTransitions="{TemplateBinding ContentTransitions}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Grid.Column="1" />
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

Двоичный файл не отображается.

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

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Machine>DELL-LATITUDE</Machine>
<WindowsUser>Beatriz</WindowsUser>
<SolutionConfiguration>Debug|AnyCPU</SolutionConfiguration>
<PackageArchitecture>neutral</PackageArchitecture>
<RegisteredManifestChecksum>D971F12887280C8AF7DAB8F576599272EEC1E1A7F8BAB355832CDC05689A8553</RegisteredManifestChecksum>
<RegisteredPackageMoniker>9970d221-97e2-4b67-a79d-51565f5a3cd4_1.0.0.0_neutral__mwdye0a0nrncr</RegisteredPackageMoniker>
<RegisteredUserModeAppID>9970d221-97e2-4b67-a79d-51565f5a3cd4_mwdye0a0nrncr!App</RegisteredUserModeAppID>
<RegisteredPackageID>9970d221-97e2-4b67-a79d-51565f5a3cd4</RegisteredPackageID>
<RegisteredPackagePublisher>CN=Beatriz</RegisteredPackagePublisher>
<RegisteredVersion>1.0.0.0</RegisteredVersion>
</PropertyGroup>
<ItemGroup>
<AppXManifest Include="C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\bin\Debug\AppxManifest.xml">
<PackagePath>AppxManifest.xml</PackagePath>
<ReRegisterAppIfChanged>true</ReRegisterAppIfChanged>
<Modified>2012-10-08T19:49:42.530</Modified>
</AppXManifest>
</ItemGroup>
<ItemGroup>
<AppxPackagedFile Include="C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\bin\Debug\BindRadioButtonsToEnums.exe">
<PackagePath>BindRadioButtonsToEnums.exe</PackagePath>
<Modified>2012-10-08T19:49:42.316</Modified>
</AppxPackagedFile>
<AppxPackagedFile Include="C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\bin\Debug\BindRadioButtonsToEnums.pdb">
<PackagePath>BindRadioButtonsToEnums.pdb</PackagePath>
<Modified>2012-10-08T19:49:42.285</Modified>
</AppxPackagedFile>
<AppxPackagedFile Include="C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\Assets\Logo.png">
<PackagePath>Assets\Logo.png</PackagePath>
<ReRegisterAppIfChanged>true</ReRegisterAppIfChanged>
<Modified>2012-06-27T19:47:34.000</Modified>
</AppxPackagedFile>
<AppxPackagedFile Include="C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\Assets\SmallLogo.png">
<PackagePath>Assets\SmallLogo.png</PackagePath>
<ReRegisterAppIfChanged>true</ReRegisterAppIfChanged>
<Modified>2012-06-27T19:47:34.000</Modified>
</AppxPackagedFile>
<AppxPackagedFile Include="C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\Assets\SplashScreen.png">
<PackagePath>Assets\SplashScreen.png</PackagePath>
<ReRegisterAppIfChanged>true</ReRegisterAppIfChanged>
<Modified>2012-06-27T19:47:34.000</Modified>
</AppxPackagedFile>
<AppxPackagedFile Include="C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\Assets\StoreLogo.png">
<PackagePath>Assets\StoreLogo.png</PackagePath>
<ReRegisterAppIfChanged>true</ReRegisterAppIfChanged>
<Modified>2012-06-27T19:47:34.000</Modified>
</AppxPackagedFile>
<AppxPackagedFile Include="C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\bin\Debug\App.xaml">
<PackagePath>App.xaml</PackagePath>
<Modified>2012-10-03T19:33:24.232</Modified>
</AppxPackagedFile>
<AppxPackagedFile Include="C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\bin\Debug\Common\StandardStyles.xaml">
<PackagePath>Common\StandardStyles.xaml</PackagePath>
<Modified>2012-06-27T19:47:34.000</Modified>
</AppxPackagedFile>
<AppxPackagedFile Include="C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\bin\Debug\Styles\ControlStyles.xaml">
<PackagePath>Styles\ControlStyles.xaml</PackagePath>
<Modified>2012-10-04T03:43:57.551</Modified>
</AppxPackagedFile>
<AppxPackagedFile Include="C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\bin\Debug\MainPage.xaml">
<PackagePath>MainPage.xaml</PackagePath>
<Modified>2012-10-08T19:48:32.027</Modified>
</AppxPackagedFile>
<AppxPackagedFile Include="C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\bin\Debug\resources.pri">
<PackagePath>resources.pri</PackagePath>
<Modified>2012-10-04T03:50:33.455</Modified>
</AppxPackagedFile>
</ItemGroup>
<ItemGroup>
</ItemGroup>
</Project>

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

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:build="http://schemas.microsoft.com/developer/appx/2012/build" IgnorableNamespaces="build">
<!--
THIS PACKAGE MANIFEST FILE IS GENERATED BY THE BUILD PROCESS.
Changes to this file will be lost when it is regenerated. To correct errors in this file, edit the source .appxmanifest file.
For more information on package manifest files, see http://go.microsoft.com/fwlink/?LinkID=241727
-->
<Identity Name="9970d221-97e2-4b67-a79d-51565f5a3cd4" Publisher="CN=Beatriz" Version="1.0.0.0" ProcessorArchitecture="neutral" />
<Properties>
<DisplayName>BindRadioButtonsToEnums</DisplayName>
<PublisherDisplayName>Beatriz</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
</Properties>
<Prerequisites>
<OSMinVersion>6.2.1</OSMinVersion>
<OSMaxVersionTested>6.2.1</OSMaxVersionTested>
</Prerequisites>
<Resources>
<Resource Language="EN-US" />
</Resources>
<Applications>
<Application Id="App" Executable="BindRadioButtonsToEnums.exe" EntryPoint="BindRadioButtonsToEnums.App">
<VisualElements DisplayName="BindRadioButtonsToEnums" Logo="Assets\Logo.png" SmallLogo="Assets\SmallLogo.png" Description="BindRadioButtonsToEnums" ForegroundText="light" BackgroundColor="#464646">
<DefaultTile ShowName="allLogos" />
<SplashScreen Image="Assets\SplashScreen.png" />
</VisualElements>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
</Capabilities>
<build:Metadata>
<build:Item Name="TargetFrameworkMoniker" Value=".NETCore,Version=v4.5" />
<build:Item Name="VisualStudio" Version="11.0" />
<build:Item Name="OperatingSystem" Version="6.2.8520.0 (fbl_eeap.120722-1632)" />
<build:Item Name="Microsoft.Build.AppxPackage.dll" Version="11.0.50722.1" />
<build:Item Name="Microsoft.Windows.UI.Xaml.Build.Tasks.dll" Version="11.0.50722.1" />
<build:Item Name="MakePri.exe" Version="6.2.8521.0 (win8_rtm.120720-1844)" />
</build:Metadata>
</Package>

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

@ -0,0 +1,71 @@
<common:LayoutAwarePage
x:Name="pageRoot"
x:Class="BindRadioButtonsToEnums.BasicPage1"
DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:BindRadioButtonsToEnums"
xmlns:common="using:BindRadioButtonsToEnums.Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Page.Resources>
<!-- TODO: Delete this line if the key AppName is declared in App.xaml -->
<x:String x:Key="AppName">My Application</x:String>
</Page.Resources>
<!--
This grid acts as a root panel for the page that defines two rows:
* Row 0 contains the back button and page title
* Row 1 contains the rest of the page layout
-->
<Grid Style="{StaticResource LayoutRootStyle}">
<Grid.RowDefinitions>
<RowDefinition Height="140"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Back button and page title -->
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button x:ConnectionId='1' x:Name="backButton" IsEnabled="{Binding Frame.CanGoBack, ElementName=pageRoot}" Style="{StaticResource BackButtonStyle}"/>
<TextBlock x:Name="pageTitle" Grid.Column="1" Text="{StaticResource AppName}" Style="{StaticResource PageHeaderTextStyle}"/>
</Grid>
<VisualStateManager.VisualStateGroups>
<!-- Visual states reflect the application's view state -->
<VisualStateGroup x:Name="ApplicationViewStates">
<VisualState x:Name="FullScreenLandscape"/>
<VisualState x:Name="Filled"/>
<!-- The entire page respects the narrower 100-pixel margin convention for portrait -->
<VisualState x:Name="FullScreenPortrait">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PortraitBackButtonStyle}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<!-- The back button and title have different styles when snapped -->
<VisualState x:Name="Snapped">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedBackButtonStyle}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="pageTitle" Storyboard.TargetProperty="Style">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedPageHeaderTextStyle}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</common:LayoutAwarePage>

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

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Machine>DELL-LATITUDE</Machine>
<WindowsUser>Beatriz</WindowsUser>
<SolutionConfiguration>Debug|AnyCPU</SolutionConfiguration>
<PackageArchitecture>neutral</PackageArchitecture>
</PropertyGroup>
<ItemGroup>
<AppXManifest Include="C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\bin\Debug\AppxManifest.xml">
<PackagePath>AppxManifest.xml</PackagePath>
<ReRegisterAppIfChanged>true</ReRegisterAppIfChanged>
</AppXManifest>
</ItemGroup>
<ItemGroup>
<AppxPackagedFile Include="C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\bin\Debug\BindRadioButtonsToEnums.exe">
<PackagePath>BindRadioButtonsToEnums.exe</PackagePath>
</AppxPackagedFile>
<AppxPackagedFile Include="C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\bin\Debug\BindRadioButtonsToEnums.pdb">
<PackagePath>BindRadioButtonsToEnums.pdb</PackagePath>
</AppxPackagedFile>
<AppxPackagedFile Include="C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\Assets\Logo.png">
<PackagePath>Assets\Logo.png</PackagePath>
<ReRegisterAppIfChanged>true</ReRegisterAppIfChanged>
</AppxPackagedFile>
<AppxPackagedFile Include="C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\Assets\SmallLogo.png">
<PackagePath>Assets\SmallLogo.png</PackagePath>
<ReRegisterAppIfChanged>true</ReRegisterAppIfChanged>
</AppxPackagedFile>
<AppxPackagedFile Include="C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\Assets\SplashScreen.png">
<PackagePath>Assets\SplashScreen.png</PackagePath>
<ReRegisterAppIfChanged>true</ReRegisterAppIfChanged>
</AppxPackagedFile>
<AppxPackagedFile Include="C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\Assets\StoreLogo.png">
<PackagePath>Assets\StoreLogo.png</PackagePath>
<ReRegisterAppIfChanged>true</ReRegisterAppIfChanged>
</AppxPackagedFile>
<AppxPackagedFile Include="C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\bin\Debug\App.xaml">
<PackagePath>App.xaml</PackagePath>
</AppxPackagedFile>
<AppxPackagedFile Include="C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\bin\Debug\Common\StandardStyles.xaml">
<PackagePath>Common\StandardStyles.xaml</PackagePath>
</AppxPackagedFile>
<AppxPackagedFile Include="C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\bin\Debug\Styles\ControlStyles.xaml">
<PackagePath>Styles\ControlStyles.xaml</PackagePath>
</AppxPackagedFile>
<AppxPackagedFile Include="C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\bin\Debug\MainPage.xaml">
<PackagePath>MainPage.xaml</PackagePath>
</AppxPackagedFile>
<AppxPackagedFile Include="C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\bin\Debug\resources.pri">
<PackagePath>resources.pri</PackagePath>
</AppxPackagedFile>
</ItemGroup>
<ItemGroup>
</ItemGroup>
</Project>

Двоичный файл не отображается.

Двоичный файл не отображается.

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -0,0 +1,277 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:BindRadioButtonsToEnums">
<Style TargetType="ListBox" x:Key="ListBox1Style">
<Setter Property="Foreground" Value="{StaticResource ListBoxForegroundThemeBrush}" />
<Setter Property="Background" Value="{x:Null}" />
<Setter Property="BorderBrush" Value="{StaticResource ListBoxBorderThemeBrush}" />
<Setter Property="BorderThickness" Value="{StaticResource ListBoxBorderThemeThickness}" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="ScrollViewer.HorizontalScrollMode" Value="Disabled" />
<Setter Property="ScrollViewer.IsHorizontalRailEnabled" Value="True" />
<Setter Property="ScrollViewer.VerticalScrollMode" Value="Enabled" />
<Setter Property="ScrollViewer.IsVerticalRailEnabled" Value="True" />
<Setter Property="ScrollViewer.ZoomMode" Value="Disabled" />
<Setter Property="ScrollViewer.IsDeferredScrollingEnabled" Value="False" />
<Setter Property="ScrollViewer.BringIntoViewOnFocusChange" Value="True" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="TabNavigation" Value="Once" />
<Setter Property="FontFamily" Value="{StaticResource ContentControlThemeFontFamily}" />
<Setter Property="FontSize" Value="{StaticResource ControlContentThemeFontSize}" />
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBox">
<Border x:Name="LayoutRoot"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot"
Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="Transparent" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot"
Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ListBoxDisabledForegroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Focused">
</VisualState>
<VisualState x:Name="Unfocused"/>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<ScrollViewer x:Name="ScrollViewer"
Padding="{TemplateBinding Padding}"
TabNavigation="{TemplateBinding TabNavigation}"
HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}"
IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}"
ZoomMode="{TemplateBinding ScrollViewer.ZoomMode}"
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
BringIntoViewOnFocusChange="{TemplateBinding ScrollViewer.BringIntoViewOnFocusChange}">
<ItemsPresenter />
</ScrollViewer>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="ListBoxItem" x:Key="RadioButtonListBoxItemStyle">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{StaticResource RadioButtonContentForegroundThemeBrush}"/>
<Setter Property="Padding" Value="1,4,0,0" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="VerticalContentAlignment" Value="Top" />
<Setter Property="FontFamily" Value="{StaticResource ContentControlThemeFontFamily}" />
<Setter Property="FontSize" Value="{StaticResource ControlContentThemeFontSize}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundEllipse"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonPointerOverBackgroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundEllipse"
Storyboard.TargetProperty="Stroke">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonPointerOverBorderThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonPointerOverForegroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundEllipse"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonPressedBackgroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundEllipse"
Storyboard.TargetProperty="Stroke">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonPressedBorderThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonPressedForegroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundEllipse"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonDisabledBackgroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundEllipse"
Storyboard.TargetProperty="Stroke">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonDisabledBorderThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonDisabledForegroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter"
Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonContentDisabledForegroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="SelectionStates">
<VisualState x:Name="Unselected" />
<VisualState x:Name="Selected">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
</Storyboard>
</VisualState>
<VisualState x:Name="SelectedUnfocused">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
</Storyboard>
</VisualState>
<VisualState x:Name="SelectedDisabled">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
</Storyboard>
</VisualState>
<VisualState x:Name="SelectedPointerOver">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
</Storyboard>
</VisualState>
<VisualState x:Name="SelectedPressed">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
</Storyboard>
</VisualState>
</VisualStateGroup>
<!--<VisualStateGroup x:Name="CheckStates">
<VisualState x:Name="Checked">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
</Storyboard>
</VisualState>
<VisualState x:Name="Unchecked" />
<VisualState x:Name="Indeterminate" />
</VisualStateGroup>-->
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Focused">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="FocusVisualWhite"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
<DoubleAnimation Storyboard.TargetName="FocusVisualBlack"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
</Storyboard>
</VisualState>
<VisualState x:Name="Unfocused" />
<VisualState x:Name="PointerFocused" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="29" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid VerticalAlignment="Top">
<Ellipse x:Name="BackgroundEllipse"
Width="23"
Height="23"
UseLayoutRounding="False"
Fill="{StaticResource RadioButtonBackgroundThemeBrush}"
Stroke="{StaticResource RadioButtonBorderThemeBrush}"
StrokeThickness="{StaticResource RadioButtonBorderThemeThickness}" />
<Ellipse x:Name="CheckGlyph"
Width="13"
Height="13"
UseLayoutRounding="False"
Opacity="0"
Fill="{StaticResource RadioButtonForegroundThemeBrush}" />
<Rectangle x:Name="FocusVisualWhite"
Stroke="{StaticResource FocusVisualWhiteStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
StrokeDashOffset="1.5"
Width="29"
Height="29" />
<Rectangle x:Name="FocusVisualBlack"
Stroke="{StaticResource FocusVisualBlackStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
StrokeDashOffset="0.5"
Width="29"
Height="29" />
</Grid>
<ContentPresenter x:Name="ContentPresenter"
Content="{TemplateBinding Content}"
ContentTransitions="{TemplateBinding ContentTransitions}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Grid.Column="1" />
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

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

@ -0,0 +1,169 @@
<Page
x:Class="BindRadioButtonsToEnums.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:BindRadioButtonsToEnums"
xmlns:viewmodels="using:BindRadioButtonsToEnums.ViewModels"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:converters="using:BindRadioButtonsToEnums.Converters"
mc:Ignorable="d">
<Page.Resources>
<converters:TransportationModeToBooleanConverter x:Key="transportationModeToBooleanConverter"/>
<Style x:Key="SampleTitleTextStyle"
TargetType="TextBlock"
BasedOn="{StaticResource SubheaderTextStyle}">
<Setter Property="Margin" Value="0,60,0,20"/>
</Style>
<Style x:Key="SummaryTextStyle"
TargetType="TextBlock"
BasedOn="{StaticResource BodyTextStyle}">
<Setter Property="Margin" Value="0,20,0,20"/>
</Style>
</Page.Resources>
<Grid Style="{StaticResource LayoutRootStyle}">
<Grid.RowDefinitions>
<RowDefinition Height="140"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Back button and page title -->
<Grid>
<TextBlock Text="Binding Radio Buttons to Enums"
Style="{StaticResource PageHeaderTextStyle}"
Margin="120,0,0,0"/>
</Grid>
<!-- content -->
<Grid Grid.Row="1" Margin="120,0,120,0">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<!-- sample 1 -->
<StackPanel x:Name="sample1">
<StackPanel.DataContext>
<viewmodels:JourneyViewModel1/>
</StackPanel.DataContext>
<TextBlock Text="Sample 1"
Style="{StaticResource SampleTitleTextStyle}"/>
<ListBox ItemsSource="{Binding Path=AvailableTransportationModes}"
SelectedItem="{Binding SelectedTransportationMode, Mode=TwoWay}"
ItemContainerStyle="{StaticResource RadioButtonListBoxItemStyle}"
Style="{StaticResource RadioButtonListBoxStyle}"/>
<TextBlock Style="{StaticResource SummaryTextStyle}">
<Run>Selected value:</Run>
<Run FontWeight="SemiBold"
Text="{Binding Path=SelectedTransportationMode}"/>
<LineBreak/>
<Run>Estimated duration:</Run>
<Run FontWeight="SemiBold"
Text="{Binding Path=EstimatedDuration}"/>
</TextBlock>
<Button Content="Go by bicycle" Command="{Binding GoByBicycleCommand}"/>
</StackPanel>
<!-- sample 2 -->
<StackPanel Grid.Column="1">
<StackPanel.DataContext>
<viewmodels:JourneyViewModel2/>
</StackPanel.DataContext>
<TextBlock Text="Sample 2" Style="{StaticResource SampleTitleTextStyle}"/>
<StackPanel>
<RadioButton Content="Car" GroupName="Group2"
IsChecked="{Binding IsCar, Mode=TwoWay}"/>
<RadioButton Content="Bicycle" GroupName="Group2"
IsChecked="{Binding IsBicycle, Mode=TwoWay}"/>
<RadioButton Content="Train" GroupName="Group2"
IsChecked="{Binding IsTrain, Mode=TwoWay}"/>
<RadioButton Content="Boat" GroupName="Group2"
IsChecked="{Binding IsBoat, Mode=TwoWay}"/>
<RadioButton Content="Rickshaw" GroupName="Group2"
IsChecked="{Binding IsRickshaw, Mode=TwoWay}"/>
<RadioButton Content="Hovercraft" GroupName="Group2"
IsChecked="{Binding IsHovercraft, Mode=TwoWay}"/>
</StackPanel>
<TextBlock Style="{StaticResource SummaryTextStyle}">
<Run>Selected value:</Run>
<Run FontWeight="SemiBold"
Text="{Binding Path=SelectedTransportationMode}"/>
<LineBreak/>
<Run>Estimated duration:</Run>
<Run FontWeight="SemiBold"
Text="{Binding Path=EstimatedDuration}"/>
</TextBlock>
<Button Content="Go by bicycle" Command="{Binding GoByBicycleCommand}"/>
</StackPanel>
<!-- sample 3 -->
<StackPanel Grid.Column="2">
<StackPanel.DataContext>
<viewmodels:JourneyViewModel3/>
</StackPanel.DataContext>
<TextBlock Text="Sample 3" Style="{StaticResource SampleTitleTextStyle}"/>
<StackPanel>
<RadioButton Content="Car" GroupName="Group3"
IsChecked="{Binding
Path=SelectedTransportationMode,
Converter={StaticResource transportationModeToBooleanConverter},
ConverterParameter=Car,
Mode=TwoWay}"/>
<RadioButton Content="Bicycle" GroupName="Group3"
IsChecked="{Binding
Path=SelectedTransportationMode,
Converter={StaticResource transportationModeToBooleanConverter},
ConverterParameter=Bicycle,
Mode=TwoWay}"/>
<RadioButton Content="Train" GroupName="Group3"
IsChecked="{Binding
Path=SelectedTransportationMode,
Converter={StaticResource transportationModeToBooleanConverter},
ConverterParameter=Train,
Mode=TwoWay}"/>
<RadioButton Content="Boat" GroupName="Group3"
IsChecked="{Binding
Path=SelectedTransportationMode,
Converter={StaticResource transportationModeToBooleanConverter},
ConverterParameter=Boat,
Mode=TwoWay}"/>
<RadioButton Content="Rickshaw" GroupName="Group3"
IsChecked="{Binding
Path=SelectedTransportationMode,
Converter={StaticResource transportationModeToBooleanConverter},
ConverterParameter=Rickshaw,
Mode=TwoWay}"/>
<RadioButton Content="Hovercraft" GroupName="Group3"
IsChecked="{Binding
Path=SelectedTransportationMode,
Converter={StaticResource transportationModeToBooleanConverter},
ConverterParameter=Hovercraft,
Mode=TwoWay}"/>
</StackPanel>
<TextBlock Style="{StaticResource SummaryTextStyle}">
<Run>Selected value:</Run>
<Run FontWeight="SemiBold"
Text="{Binding Path=SelectedTransportationMode}"/>
<LineBreak/>
<Run>Estimated duration:</Run>
<Run FontWeight="SemiBold"
Text="{Binding Path=EstimatedDuration}"/>
</TextBlock>
<Button Content="Go by bicycle" Command="{Binding GoByBicycleCommand}"/>
</StackPanel>
<!-- sample 4 -->
<StackPanel Grid.Column="3">
</StackPanel>
</Grid>
</Grid>
</Page>

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

@ -0,0 +1,265 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:BindRadioButtonsToEnums">
<Style TargetType="ListBox" x:Key="RadioButtonListBoxStyle">
<Setter Property="Foreground" Value="{StaticResource ListBoxForegroundThemeBrush}" />
<Setter Property="Background" Value="{x:Null}" />
<Setter Property="BorderBrush" Value="{StaticResource ListBoxBorderThemeBrush}" />
<Setter Property="BorderThickness" Value="{StaticResource ListBoxBorderThemeThickness}" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="ScrollViewer.HorizontalScrollMode" Value="Disabled" />
<Setter Property="ScrollViewer.IsHorizontalRailEnabled" Value="True" />
<Setter Property="ScrollViewer.VerticalScrollMode" Value="Enabled" />
<Setter Property="ScrollViewer.IsVerticalRailEnabled" Value="True" />
<Setter Property="ScrollViewer.ZoomMode" Value="Disabled" />
<Setter Property="ScrollViewer.IsDeferredScrollingEnabled" Value="False" />
<Setter Property="ScrollViewer.BringIntoViewOnFocusChange" Value="True" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="TabNavigation" Value="Once" />
<Setter Property="FontFamily" Value="{StaticResource ContentControlThemeFontFamily}" />
<Setter Property="FontSize" Value="{StaticResource ControlContentThemeFontSize}" />
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBox">
<Border x:Name="LayoutRoot"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot"
Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="Transparent" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot"
Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ListBoxDisabledForegroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Focused">
</VisualState>
<VisualState x:Name="Unfocused"/>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<ScrollViewer x:Name="ScrollViewer"
Padding="{TemplateBinding Padding}"
TabNavigation="{TemplateBinding TabNavigation}"
HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}"
IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}"
ZoomMode="{TemplateBinding ScrollViewer.ZoomMode}"
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
BringIntoViewOnFocusChange="{TemplateBinding ScrollViewer.BringIntoViewOnFocusChange}">
<ItemsPresenter />
</ScrollViewer>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="ListBoxItem" x:Key="RadioButtonListBoxItemStyle">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{StaticResource RadioButtonContentForegroundThemeBrush}"/>
<Setter Property="Padding" Value="1,4,0,0" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="VerticalContentAlignment" Value="Top" />
<Setter Property="FontFamily" Value="{StaticResource ContentControlThemeFontFamily}" />
<Setter Property="FontSize" Value="{StaticResource ControlContentThemeFontSize}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundEllipse"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonPointerOverBackgroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundEllipse"
Storyboard.TargetProperty="Stroke">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonPointerOverBorderThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonPointerOverForegroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundEllipse"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonPressedBackgroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundEllipse"
Storyboard.TargetProperty="Stroke">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonPressedBorderThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonPressedForegroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundEllipse"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonDisabledBackgroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundEllipse"
Storyboard.TargetProperty="Stroke">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonDisabledBorderThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonDisabledForegroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter"
Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonContentDisabledForegroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="SelectionStates">
<VisualState x:Name="Unselected" />
<VisualState x:Name="Selected">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
</Storyboard>
</VisualState>
<VisualState x:Name="SelectedUnfocused">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
</Storyboard>
</VisualState>
<VisualState x:Name="SelectedDisabled">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
</Storyboard>
</VisualState>
<VisualState x:Name="SelectedPointerOver">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
</Storyboard>
</VisualState>
<VisualState x:Name="SelectedPressed">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Focused">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="FocusVisualWhite"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
<DoubleAnimation Storyboard.TargetName="FocusVisualBlack"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
</Storyboard>
</VisualState>
<VisualState x:Name="Unfocused" />
<VisualState x:Name="PointerFocused" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="29" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid VerticalAlignment="Top">
<Ellipse x:Name="BackgroundEllipse"
Width="23"
Height="23"
UseLayoutRounding="False"
Fill="{StaticResource RadioButtonBackgroundThemeBrush}"
Stroke="{StaticResource RadioButtonBorderThemeBrush}"
StrokeThickness="{StaticResource RadioButtonBorderThemeThickness}" />
<Ellipse x:Name="CheckGlyph"
Width="13"
Height="13"
UseLayoutRounding="False"
Opacity="0"
Fill="{StaticResource RadioButtonForegroundThemeBrush}" />
<Rectangle x:Name="FocusVisualWhite"
Stroke="{StaticResource FocusVisualWhiteStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
StrokeDashOffset="1.5"
Width="29"
Height="29" />
<Rectangle x:Name="FocusVisualBlack"
Stroke="{StaticResource FocusVisualBlackStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
StrokeDashOffset="0.5"
Width="29"
Height="29" />
</Grid>
<ContentPresenter x:Name="ContentPresenter"
Content="{TemplateBinding Content}"
ContentTransitions="{TemplateBinding ContentTransitions}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Grid.Column="1" />
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

Двоичный файл не отображается.

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

@ -0,0 +1,27 @@

#pragma checksum "C:\Work\BlogExperiments\BindRadioButtonsToEnums\BindRadioButtonsToEnums\App.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "98A7C5EB773CE37FF093F467A26DB978"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace BindRadioButtonsToEnums
{
partial class App : global::Windows.UI.Xaml.Application, global::Windows.UI.Xaml.Markup.IComponentConnector
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks"," 4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public void Connect(int connectionId, object target)
{
this._contentLoaded = true;
}
}
}

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

@ -0,0 +1,56 @@

#pragma checksum "C:\Work\BlogExperiments\BindRadioButtonsToEnums\BindRadioButtonsToEnums\App.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "98A7C5EB773CE37FF093F467A26DB978"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace BindRadioButtonsToEnums
{
#if !DISABLE_XAML_GENERATED_MAIN
public static class Program
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks"," 4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
static void Main(string[] args)
{
global::Windows.UI.Xaml.Application.Start((p) => new App());
}
}
#endif
partial class App : global::Windows.UI.Xaml.Application
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks"," 4.0.0.0")]
private bool _contentLoaded;
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks"," 4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public void InitializeComponent()
{
if (_contentLoaded)
return;
_contentLoaded = true;
#if DEBUG && !DISABLE_XAML_GENERATED_BINDING_DEBUG_OUTPUT
DebugSettings.BindingFailed += (sender, args) =>
{
global::System.Diagnostics.Debug.WriteLine(args.Message);
};
#endif
#if DEBUG && !DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION
UnhandledException += (sender, e) =>
{
if (global::System.Diagnostics.Debugger.IsAttached) global::System.Diagnostics.Debugger.Break();
};
#endif
}
}
}

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

@ -0,0 +1,22 @@
<Application
x:Class="BindRadioButtonsToEnums.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:BindRadioButtonsToEnums">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!--
Styles that define common aspects of the platform look and feel
Required by Visual Studio project and item templates
-->
<ResourceDictionary Source="Common/StandardStyles.xaml"/>
<ResourceDictionary Source="Styles/ControlStyles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

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

@ -0,0 +1,90 @@
C:\Work\BlogExperiments\BindRadioButtonsToEnums\BindRadioButtonsToEnums\bin\Debug\BindRadioButtonsToEnums.exe
C:\Work\BlogExperiments\BindRadioButtonsToEnums\BindRadioButtonsToEnums\bin\Debug\BindRadioButtonsToEnums.pdb
C:\Work\BlogExperiments\BindRadioButtonsToEnums\BindRadioButtonsToEnums\bin\Debug\resources.pri
C:\Work\BlogExperiments\BindRadioButtonsToEnums\BindRadioButtonsToEnums\bin\Debug\AppxManifest.xml
C:\Work\BlogExperiments\BindRadioButtonsToEnums\BindRadioButtonsToEnums\bin\Debug\BindRadioButtonsToEnums.build.appxrecipe
C:\Work\BlogExperiments\BindRadioButtonsToEnums\BindRadioButtonsToEnums\obj\Debug\App.g.i.cs
C:\Work\BlogExperiments\BindRadioButtonsToEnums\BindRadioButtonsToEnums\obj\Debug\App.g.cs
C:\Work\BlogExperiments\BindRadioButtonsToEnums\BindRadioButtonsToEnums\obj\Debug\Common\StandardStyles.g.i.cs
C:\Work\BlogExperiments\BindRadioButtonsToEnums\BindRadioButtonsToEnums\obj\Debug\Common\StandardStyles.g.cs
C:\Work\BlogExperiments\BindRadioButtonsToEnums\BindRadioButtonsToEnums\obj\Debug\MainPage.g.i.cs
C:\Work\BlogExperiments\BindRadioButtonsToEnums\BindRadioButtonsToEnums\obj\Debug\MainPage.g.cs
C:\Work\BlogExperiments\BindRadioButtonsToEnums\BindRadioButtonsToEnums\obj\Debug\XamlTypeInfo.g.cs
C:\Work\BlogExperiments\BindRadioButtonsToEnums\BindRadioButtonsToEnums\obj\Debug\App.xaml
C:\Work\BlogExperiments\BindRadioButtonsToEnums\BindRadioButtonsToEnums\obj\Debug\Common\StandardStyles.xaml
C:\Work\BlogExperiments\BindRadioButtonsToEnums\BindRadioButtonsToEnums\obj\Debug\MainPage.xaml
C:\Work\BlogExperiments\BindRadioButtonsToEnums\BindRadioButtonsToEnums\obj\Debug\BindRadioButtonsToEnums.exe
C:\Work\BlogExperiments\BindRadioButtonsToEnums\BindRadioButtonsToEnums\obj\Debug\BindRadioButtonsToEnums.pdb
C:\Work\BlogExperiments\BindRadioButtonsToEnums\BindRadioButtonsToEnums\obj\Debug\priconfig.xml
C:\Work\BlogExperiments\BindRadioButtonsToEnums\BindRadioButtonsToEnums\obj\Debug\layout.resfiles
C:\Work\BlogExperiments\BindRadioButtonsToEnums\BindRadioButtonsToEnums\obj\Debug\resources.resfiles
C:\Work\BlogExperiments\BindRadioButtonsToEnums\BindRadioButtonsToEnums\obj\Debug\pri.resfiles
C:\Work\BlogExperiments\BindRadioButtonsToEnums\BindRadioButtonsToEnums\obj\Debug\LanguageQualifiers.txt
C:\Work\BlogExperiments\BindRadioButtonsToEnums\BindRadioButtonsToEnums\obj\Debug\ProjectArchitectures.txt
C:\Work\BlogExperiments\BindRadioButtonsToEnums\BindRadioButtonsToEnums\obj\Debug\priconfig.xml.intermediate
C:\Work\BlogExperiments\BindRadioButtonsToEnums\BindRadioButtonsToEnums\obj\Debug\layout.resfiles.intermediate
C:\Work\BlogExperiments\BindRadioButtonsToEnums\BindRadioButtonsToEnums\obj\Debug\resources.resfiles.intermediate
C:\Work\BlogExperiments\BindRadioButtonsToEnums\BindRadioButtonsToEnums\obj\Debug\pri.resfiles.intermediate
C:\Work\BlogExperiments\BindRadioButtonsToEnums\BindRadioButtonsToEnums\obj\Debug\Styles\ControlStyles.g.i.cs
C:\Work\BlogExperiments\BindRadioButtonsToEnums\BindRadioButtonsToEnums\obj\Debug\Styles\ControlStyles.g.cs
C:\Work\BlogExperiments\BindRadioButtonsToEnums\BindRadioButtonsToEnums\obj\Debug\Styles\ControlStyles.xaml
C:\Work\BlogExperiments\BindRadioButtonsToEnums4\BindRadioButtonsToEnums\bin\Debug\BindRadioButtonsToEnums.exe
C:\Work\BlogExperiments\BindRadioButtonsToEnums4\BindRadioButtonsToEnums\bin\Debug\BindRadioButtonsToEnums.pdb
C:\Work\BlogExperiments\BindRadioButtonsToEnums4\BindRadioButtonsToEnums\bin\Debug\resources.pri
C:\Work\BlogExperiments\BindRadioButtonsToEnums4\BindRadioButtonsToEnums\bin\Debug\AppxManifest.xml
C:\Work\BlogExperiments\BindRadioButtonsToEnums4\BindRadioButtonsToEnums\bin\Debug\BindRadioButtonsToEnums.build.appxrecipe
C:\Work\BlogExperiments\BindRadioButtonsToEnums4\BindRadioButtonsToEnums\obj\Debug\App.g.i.cs
C:\Work\BlogExperiments\BindRadioButtonsToEnums4\BindRadioButtonsToEnums\obj\Debug\App.g.cs
C:\Work\BlogExperiments\BindRadioButtonsToEnums4\BindRadioButtonsToEnums\obj\Debug\Common\StandardStyles.g.i.cs
C:\Work\BlogExperiments\BindRadioButtonsToEnums4\BindRadioButtonsToEnums\obj\Debug\Common\StandardStyles.g.cs
C:\Work\BlogExperiments\BindRadioButtonsToEnums4\BindRadioButtonsToEnums\obj\Debug\Styles\ControlStyles.g.i.cs
C:\Work\BlogExperiments\BindRadioButtonsToEnums4\BindRadioButtonsToEnums\obj\Debug\Styles\ControlStyles.g.cs
C:\Work\BlogExperiments\BindRadioButtonsToEnums4\BindRadioButtonsToEnums\obj\Debug\MainPage.g.i.cs
C:\Work\BlogExperiments\BindRadioButtonsToEnums4\BindRadioButtonsToEnums\obj\Debug\MainPage.g.cs
C:\Work\BlogExperiments\BindRadioButtonsToEnums4\BindRadioButtonsToEnums\obj\Debug\XamlTypeInfo.g.cs
C:\Work\BlogExperiments\BindRadioButtonsToEnums4\BindRadioButtonsToEnums\obj\Debug\App.xaml
C:\Work\BlogExperiments\BindRadioButtonsToEnums4\BindRadioButtonsToEnums\obj\Debug\Common\StandardStyles.xaml
C:\Work\BlogExperiments\BindRadioButtonsToEnums4\BindRadioButtonsToEnums\obj\Debug\Styles\ControlStyles.xaml
C:\Work\BlogExperiments\BindRadioButtonsToEnums4\BindRadioButtonsToEnums\obj\Debug\MainPage.xaml
C:\Work\BlogExperiments\BindRadioButtonsToEnums4\BindRadioButtonsToEnums\obj\Debug\BindRadioButtonsToEnums.exe
C:\Work\BlogExperiments\BindRadioButtonsToEnums4\BindRadioButtonsToEnums\obj\Debug\BindRadioButtonsToEnums.pdb
C:\Work\BlogExperiments\BindRadioButtonsToEnums4\BindRadioButtonsToEnums\obj\Debug\priconfig.xml.intermediate
C:\Work\BlogExperiments\BindRadioButtonsToEnums4\BindRadioButtonsToEnums\obj\Debug\layout.resfiles.intermediate
C:\Work\BlogExperiments\BindRadioButtonsToEnums4\BindRadioButtonsToEnums\obj\Debug\resources.resfiles.intermediate
C:\Work\BlogExperiments\BindRadioButtonsToEnums4\BindRadioButtonsToEnums\obj\Debug\pri.resfiles.intermediate
C:\Work\BlogExperiments\BindRadioButtonsToEnums4\BindRadioButtonsToEnums\obj\Debug\priconfig.xml
C:\Work\BlogExperiments\BindRadioButtonsToEnums4\BindRadioButtonsToEnums\obj\Debug\layout.resfiles
C:\Work\BlogExperiments\BindRadioButtonsToEnums4\BindRadioButtonsToEnums\obj\Debug\resources.resfiles
C:\Work\BlogExperiments\BindRadioButtonsToEnums4\BindRadioButtonsToEnums\obj\Debug\pri.resfiles
C:\Work\BlogExperiments\BindRadioButtonsToEnums4\BindRadioButtonsToEnums\obj\Debug\LanguageQualifiers.txt
C:\Work\BlogExperiments\BindRadioButtonsToEnums4\BindRadioButtonsToEnums\obj\Debug\ProjectArchitectures.txt
C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\bin\Debug\BindRadioButtonsToEnums.exe
C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\bin\Debug\BindRadioButtonsToEnums.pdb
C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\bin\Debug\resources.pri
C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\bin\Debug\AppxManifest.xml
C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\bin\Debug\BindRadioButtonsToEnums.build.appxrecipe
C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\obj\Debug\App.g.i.cs
C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\obj\Debug\App.g.cs
C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\obj\Debug\Common\StandardStyles.g.i.cs
C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\obj\Debug\Common\StandardStyles.g.cs
C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\obj\Debug\Styles\ControlStyles.g.i.cs
C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\obj\Debug\Styles\ControlStyles.g.cs
C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\obj\Debug\MainPage.g.i.cs
C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\obj\Debug\MainPage.g.cs
C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\obj\Debug\XamlTypeInfo.g.cs
C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\obj\Debug\App.xaml
C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\obj\Debug\Common\StandardStyles.xaml
C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\obj\Debug\Styles\ControlStyles.xaml
C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\obj\Debug\MainPage.xaml
C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\obj\Debug\BindRadioButtonsToEnums.exe
C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\obj\Debug\BindRadioButtonsToEnums.pdb
C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\obj\Debug\priconfig.xml.intermediate
C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\obj\Debug\layout.resfiles.intermediate
C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\obj\Debug\resources.resfiles.intermediate
C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\obj\Debug\pri.resfiles.intermediate
C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\obj\Debug\priconfig.xml
C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\obj\Debug\layout.resfiles
C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\obj\Debug\resources.resfiles
C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\obj\Debug\pri.resfiles
C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\obj\Debug\LanguageQualifiers.txt
C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\obj\Debug\ProjectArchitectures.txt

Двоичный файл не отображается.

Двоичный файл не отображается.

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

@ -0,0 +1,35 @@

#pragma checksum "C:\Work\BlogExperiments\BindRadioButtonsToEnums\BindRadioButtonsToEnums\BlankPage1.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "4373B60A803A772C321F27E5126AACA6"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace BindRadioButtonsToEnums
{
partial class BlankPage1 : global::Windows.UI.Xaml.Controls.Page
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks"," 4.0.0.0")]
private bool _contentLoaded;
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks"," 4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public void InitializeComponent()
{
if (_contentLoaded)
return;
_contentLoaded = true;
global::Windows.UI.Xaml.Application.LoadComponent(this, new global::System.Uri("ms-appx:///BlankPage1.xaml"), global::Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);
}
}
}

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

@ -0,0 +1 @@


Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -0,0 +1,27 @@

#pragma checksum "C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\MainPage.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "3D65BF37B4622EA63142BDC75501ABEC"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace BindRadioButtonsToEnums
{
partial class MainPage : global::Windows.UI.Xaml.Controls.Page, global::Windows.UI.Xaml.Markup.IComponentConnector
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks"," 4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public void Connect(int connectionId, object target)
{
this._contentLoaded = true;
}
}
}

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

@ -0,0 +1,38 @@

#pragma checksum "C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\MainPage.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "3D65BF37B4622EA63142BDC75501ABEC"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace BindRadioButtonsToEnums
{
partial class MainPage : global::Windows.UI.Xaml.Controls.Page
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks"," 4.0.0.0")]
private global::Windows.UI.Xaml.Controls.StackPanel sample1;
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks"," 4.0.0.0")]
private bool _contentLoaded;
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks"," 4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public void InitializeComponent()
{
if (_contentLoaded)
return;
_contentLoaded = true;
global::Windows.UI.Xaml.Application.LoadComponent(this, new global::System.Uri("ms-appx:///MainPage.xaml"), global::Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);
sample1 = (global::Windows.UI.Xaml.Controls.StackPanel)this.FindName("sample1");
}
}
}

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

@ -0,0 +1,169 @@
<Page
x:Class="BindRadioButtonsToEnums.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:BindRadioButtonsToEnums"
xmlns:viewmodels="using:BindRadioButtonsToEnums.ViewModels"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:converters="using:BindRadioButtonsToEnums.Converters"
mc:Ignorable="d">
<Page.Resources>
<converters:TransportationModeToBooleanConverter x:Key="transportationModeToBooleanConverter"/>
<Style x:Key="SampleTitleTextStyle"
TargetType="TextBlock"
BasedOn="{StaticResource SubheaderTextStyle}">
<Setter Property="Margin" Value="0,60,0,20"/>
</Style>
<Style x:Key="SummaryTextStyle"
TargetType="TextBlock"
BasedOn="{StaticResource BodyTextStyle}">
<Setter Property="Margin" Value="0,20,0,20"/>
</Style>
</Page.Resources>
<Grid Style="{StaticResource LayoutRootStyle}">
<Grid.RowDefinitions>
<RowDefinition Height="140"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- Back button and page title -->
<Grid>
<TextBlock Text="Binding Radio Buttons to Enums"
Style="{StaticResource PageHeaderTextStyle}"
Margin="120,0,0,0"/>
</Grid>
<!-- content -->
<Grid Grid.Row="1" Margin="120,0,120,0">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<!-- sample 1 -->
<StackPanel x:Name="sample1">
<StackPanel.DataContext>
<viewmodels:JourneyViewModel1/>
</StackPanel.DataContext>
<TextBlock Text="Sample 1"
Style="{StaticResource SampleTitleTextStyle}"/>
<ListBox ItemsSource="{Binding Path=AvailableTransportationModes}"
SelectedItem="{Binding SelectedTransportationMode, Mode=TwoWay}"
ItemContainerStyle="{StaticResource RadioButtonListBoxItemStyle}"
Style="{StaticResource RadioButtonListBoxStyle}"/>
<TextBlock Style="{StaticResource SummaryTextStyle}">
<Run>Selected value:</Run>
<Run FontWeight="SemiBold"
Text="{Binding Path=SelectedTransportationMode}"/>
<LineBreak/>
<Run>Estimated duration:</Run>
<Run FontWeight="SemiBold"
Text="{Binding Path=EstimatedDuration}"/>
</TextBlock>
<Button Content="Go by bicycle" Command="{Binding GoByBicycleCommand}"/>
</StackPanel>
<!-- sample 2 -->
<StackPanel Grid.Column="1">
<StackPanel.DataContext>
<viewmodels:JourneyViewModel2/>
</StackPanel.DataContext>
<TextBlock Text="Sample 2" Style="{StaticResource SampleTitleTextStyle}"/>
<StackPanel>
<RadioButton Content="Car" GroupName="Group2"
IsChecked="{Binding IsCar, Mode=TwoWay}"/>
<RadioButton Content="Bicycle" GroupName="Group2"
IsChecked="{Binding IsBicycle, Mode=TwoWay}"/>
<RadioButton Content="Train" GroupName="Group2"
IsChecked="{Binding IsTrain, Mode=TwoWay}"/>
<RadioButton Content="Boat" GroupName="Group2"
IsChecked="{Binding IsBoat, Mode=TwoWay}"/>
<RadioButton Content="Rickshaw" GroupName="Group2"
IsChecked="{Binding IsRickshaw, Mode=TwoWay}"/>
<RadioButton Content="Hovercraft" GroupName="Group2"
IsChecked="{Binding IsHovercraft, Mode=TwoWay}"/>
</StackPanel>
<TextBlock Style="{StaticResource SummaryTextStyle}">
<Run>Selected value:</Run>
<Run FontWeight="SemiBold"
Text="{Binding Path=SelectedTransportationMode}"/>
<LineBreak/>
<Run>Estimated duration:</Run>
<Run FontWeight="SemiBold"
Text="{Binding Path=EstimatedDuration}"/>
</TextBlock>
<Button Content="Go by bicycle" Command="{Binding GoByBicycleCommand}"/>
</StackPanel>
<!-- sample 3 -->
<StackPanel Grid.Column="2">
<StackPanel.DataContext>
<viewmodels:JourneyViewModel3/>
</StackPanel.DataContext>
<TextBlock Text="Sample 3" Style="{StaticResource SampleTitleTextStyle}"/>
<StackPanel>
<RadioButton Content="Car" GroupName="Group3"
IsChecked="{Binding
Path=SelectedTransportationMode,
Converter={StaticResource transportationModeToBooleanConverter},
ConverterParameter=Car,
Mode=TwoWay}"/>
<RadioButton Content="Bicycle" GroupName="Group3"
IsChecked="{Binding
Path=SelectedTransportationMode,
Converter={StaticResource transportationModeToBooleanConverter},
ConverterParameter=Bicycle,
Mode=TwoWay}"/>
<RadioButton Content="Train" GroupName="Group3"
IsChecked="{Binding
Path=SelectedTransportationMode,
Converter={StaticResource transportationModeToBooleanConverter},
ConverterParameter=Train,
Mode=TwoWay}"/>
<RadioButton Content="Boat" GroupName="Group3"
IsChecked="{Binding
Path=SelectedTransportationMode,
Converter={StaticResource transportationModeToBooleanConverter},
ConverterParameter=Boat,
Mode=TwoWay}"/>
<RadioButton Content="Rickshaw" GroupName="Group3"
IsChecked="{Binding
Path=SelectedTransportationMode,
Converter={StaticResource transportationModeToBooleanConverter},
ConverterParameter=Rickshaw,
Mode=TwoWay}"/>
<RadioButton Content="Hovercraft" GroupName="Group3"
IsChecked="{Binding
Path=SelectedTransportationMode,
Converter={StaticResource transportationModeToBooleanConverter},
ConverterParameter=Hovercraft,
Mode=TwoWay}"/>
</StackPanel>
<TextBlock Style="{StaticResource SummaryTextStyle}">
<Run>Selected value:</Run>
<Run FontWeight="SemiBold"
Text="{Binding Path=SelectedTransportationMode}"/>
<LineBreak/>
<Run>Estimated duration:</Run>
<Run FontWeight="SemiBold"
Text="{Binding Path=EstimatedDuration}"/>
</TextBlock>
<Button Content="Go by bicycle" Command="{Binding GoByBicycleCommand}"/>
</StackPanel>
<!-- sample 4 -->
<StackPanel Grid.Column="3">
</StackPanel>
</Grid>
</Grid>
</Page>

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

@ -0,0 +1 @@
C:\Work\BlogExperiments\BindRadioButtonsToEnums3\BindRadioButtonsToEnums\BindRadioButtonsToEnums.csproj;neutral

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

@ -0,0 +1 @@


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

@ -0,0 +1,265 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:BindRadioButtonsToEnums">
<Style TargetType="ListBox" x:Key="RadioButtonListBoxStyle">
<Setter Property="Foreground" Value="{StaticResource ListBoxForegroundThemeBrush}" />
<Setter Property="Background" Value="{x:Null}" />
<Setter Property="BorderBrush" Value="{StaticResource ListBoxBorderThemeBrush}" />
<Setter Property="BorderThickness" Value="{StaticResource ListBoxBorderThemeThickness}" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="ScrollViewer.HorizontalScrollMode" Value="Disabled" />
<Setter Property="ScrollViewer.IsHorizontalRailEnabled" Value="True" />
<Setter Property="ScrollViewer.VerticalScrollMode" Value="Enabled" />
<Setter Property="ScrollViewer.IsVerticalRailEnabled" Value="True" />
<Setter Property="ScrollViewer.ZoomMode" Value="Disabled" />
<Setter Property="ScrollViewer.IsDeferredScrollingEnabled" Value="False" />
<Setter Property="ScrollViewer.BringIntoViewOnFocusChange" Value="True" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="TabNavigation" Value="Once" />
<Setter Property="FontFamily" Value="{StaticResource ContentControlThemeFontFamily}" />
<Setter Property="FontSize" Value="{StaticResource ControlContentThemeFontSize}" />
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBox">
<Border x:Name="LayoutRoot"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot"
Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0" Value="Transparent" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot"
Storyboard.TargetProperty="BorderBrush">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ListBoxDisabledForegroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Focused">
</VisualState>
<VisualState x:Name="Unfocused"/>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<ScrollViewer x:Name="ScrollViewer"
Padding="{TemplateBinding Padding}"
TabNavigation="{TemplateBinding TabNavigation}"
HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}"
IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}"
ZoomMode="{TemplateBinding ScrollViewer.ZoomMode}"
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
BringIntoViewOnFocusChange="{TemplateBinding ScrollViewer.BringIntoViewOnFocusChange}">
<ItemsPresenter />
</ScrollViewer>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="ListBoxItem" x:Key="RadioButtonListBoxItemStyle">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{StaticResource RadioButtonContentForegroundThemeBrush}"/>
<Setter Property="Padding" Value="1,4,0,0" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="VerticalContentAlignment" Value="Top" />
<Setter Property="FontFamily" Value="{StaticResource ContentControlThemeFontFamily}" />
<Setter Property="FontSize" Value="{StaticResource ControlContentThemeFontSize}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundEllipse"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonPointerOverBackgroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundEllipse"
Storyboard.TargetProperty="Stroke">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonPointerOverBorderThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonPointerOverForegroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundEllipse"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonPressedBackgroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundEllipse"
Storyboard.TargetProperty="Stroke">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonPressedBorderThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonPressedForegroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundEllipse"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonDisabledBackgroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundEllipse"
Storyboard.TargetProperty="Stroke">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonDisabledBorderThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Fill">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonDisabledForegroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter"
Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource RadioButtonContentDisabledForegroundThemeBrush}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="SelectionStates">
<VisualState x:Name="Unselected" />
<VisualState x:Name="Selected">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
</Storyboard>
</VisualState>
<VisualState x:Name="SelectedUnfocused">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
</Storyboard>
</VisualState>
<VisualState x:Name="SelectedDisabled">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
</Storyboard>
</VisualState>
<VisualState x:Name="SelectedPointerOver">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
</Storyboard>
</VisualState>
<VisualState x:Name="SelectedPressed">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="CheckGlyph"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Focused">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="FocusVisualWhite"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
<DoubleAnimation Storyboard.TargetName="FocusVisualBlack"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0" />
</Storyboard>
</VisualState>
<VisualState x:Name="Unfocused" />
<VisualState x:Name="PointerFocused" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="29" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid VerticalAlignment="Top">
<Ellipse x:Name="BackgroundEllipse"
Width="23"
Height="23"
UseLayoutRounding="False"
Fill="{StaticResource RadioButtonBackgroundThemeBrush}"
Stroke="{StaticResource RadioButtonBorderThemeBrush}"
StrokeThickness="{StaticResource RadioButtonBorderThemeThickness}" />
<Ellipse x:Name="CheckGlyph"
Width="13"
Height="13"
UseLayoutRounding="False"
Opacity="0"
Fill="{StaticResource RadioButtonForegroundThemeBrush}" />
<Rectangle x:Name="FocusVisualWhite"
Stroke="{StaticResource FocusVisualWhiteStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
StrokeDashOffset="1.5"
Width="29"
Height="29" />
<Rectangle x:Name="FocusVisualBlack"
Stroke="{StaticResource FocusVisualBlackStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
StrokeDashOffset="0.5"
Width="29"
Height="29" />
</Grid>
<ContentPresenter x:Name="ContentPresenter"
Content="{TemplateBinding Content}"
ContentTransitions="{TemplateBinding ContentTransitions}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Grid.Column="1" />
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

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

@ -0,0 +1,812 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace BindRadioButtonsToEnums
{
public partial class App : global::Windows.UI.Xaml.Markup.IXamlMetadataProvider
{
private global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlTypeInfoProvider _provider;
public global::Windows.UI.Xaml.Markup.IXamlType GetXamlType(global::System.Type type)
{
if(_provider == null)
{
_provider = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlTypeInfoProvider();
}
return _provider.GetXamlTypeByType(type);
}
public global::Windows.UI.Xaml.Markup.IXamlType GetXamlType(global::System.String fullName)
{
if(_provider == null)
{
_provider = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlTypeInfoProvider();
}
return _provider.GetXamlTypeByName(fullName);
}
public global::Windows.UI.Xaml.Markup.XmlnsDefinition[] GetXmlnsDefinitions()
{
return new global::Windows.UI.Xaml.Markup.XmlnsDefinition[0];
}
}
}
namespace BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo
{
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks", "4.0.0.0")]
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
internal partial class XamlTypeInfoProvider
{
public global::Windows.UI.Xaml.Markup.IXamlType GetXamlTypeByType(global::System.Type type)
{
string standardName;
global::Windows.UI.Xaml.Markup.IXamlType xamlType = null;
if(_xamlTypeToStandardName.TryGetValue(type, out standardName))
{
xamlType = GetXamlTypeByName(standardName);
}
else
{
xamlType = GetXamlTypeByName(type.FullName);
}
return xamlType;
}
public global::Windows.UI.Xaml.Markup.IXamlType GetXamlTypeByName(string typeName)
{
if (global::System.String.IsNullOrEmpty(typeName))
{
return null;
}
global::Windows.UI.Xaml.Markup.IXamlType xamlType;
if (_xamlTypes.TryGetValue(typeName, out xamlType))
{
return xamlType;
}
xamlType = CreateXamlType(typeName);
if (xamlType != null)
{
_xamlTypes.Add(typeName, xamlType);
}
return xamlType;
}
public global::Windows.UI.Xaml.Markup.IXamlMember GetMemberByLongName(string longMemberName)
{
if (global::System.String.IsNullOrEmpty(longMemberName))
{
return null;
}
global::Windows.UI.Xaml.Markup.IXamlMember xamlMember;
if (_xamlMembers.TryGetValue(longMemberName, out xamlMember))
{
return xamlMember;
}
xamlMember = CreateXamlMember(longMemberName);
if (xamlMember != null)
{
_xamlMembers.Add(longMemberName, xamlMember);
}
return xamlMember;
}
global::System.Collections.Generic.Dictionary<string, global::Windows.UI.Xaml.Markup.IXamlType> _xamlTypes = new global::System.Collections.Generic.Dictionary<string, global::Windows.UI.Xaml.Markup.IXamlType>();
global::System.Collections.Generic.Dictionary<string, global::Windows.UI.Xaml.Markup.IXamlMember> _xamlMembers = new global::System.Collections.Generic.Dictionary<string, global::Windows.UI.Xaml.Markup.IXamlMember>();
global::System.Collections.Generic.Dictionary<global::System.Type, string> _xamlTypeToStandardName = new global::System.Collections.Generic.Dictionary<global::System.Type, string>();
private void AddToMapOfTypeToStandardName(global::System.Type t, global::System.String str)
{
if(!_xamlTypeToStandardName.ContainsKey(t))
{
_xamlTypeToStandardName.Add(t, str);
}
}
private object Activate_0_TransportationModeToBooleanConverter() { return new global::BindRadioButtonsToEnums.Converters.TransportationModeToBooleanConverter(); }
private object Activate_1_EnumToBooleanConverter() { return new global::BindRadioButtonsToEnums.Converters.EnumToBooleanConverter<global::BindRadioButtonsToEnums.Models.TransportationMode>(); }
private object Activate_2_JourneyViewModel3() { return new global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel3(); }
private object Activate_8_JourneyViewModel2() { return new global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel2(); }
private object Activate_9_JourneyViewModel1() { return new global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel1(); }
private object Activate_11_MainPage() { return new global::BindRadioButtonsToEnums.MainPage(); }
private global::Windows.UI.Xaml.Markup.IXamlType CreateXamlType(string typeName)
{
global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlSystemBaseType xamlType = null;
global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType userType;
switch (typeName)
{
case "Object":
xamlType = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlSystemBaseType(typeName, typeof(global::System.Object));
break;
case "String":
xamlType = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlSystemBaseType(typeName, typeof(global::System.String));
break;
case "Boolean":
xamlType = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlSystemBaseType(typeName, typeof(global::System.Boolean));
break;
case "Windows.UI.Xaml.Controls.Page":
xamlType = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlSystemBaseType(typeName, typeof(global::Windows.UI.Xaml.Controls.Page));
break;
case "Windows.UI.Xaml.Controls.UserControl":
xamlType = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlSystemBaseType(typeName, typeof(global::Windows.UI.Xaml.Controls.UserControl));
break;
case "BindRadioButtonsToEnums.Converters.TransportationModeToBooleanConverter":
userType = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType(this, typeName, typeof(global::BindRadioButtonsToEnums.Converters.TransportationModeToBooleanConverter), GetXamlTypeByName("BindRadioButtonsToEnums.Converters.EnumToBooleanConverter<BindRadioButtonsToEnums.Models.TransportationMode>"));
userType.Activator = Activate_0_TransportationModeToBooleanConverter;
xamlType = userType;
break;
case "BindRadioButtonsToEnums.Converters.EnumToBooleanConverter<BindRadioButtonsToEnums.Models.TransportationMode>":
userType = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType(this, typeName, typeof(global::BindRadioButtonsToEnums.Converters.EnumToBooleanConverter<global::BindRadioButtonsToEnums.Models.TransportationMode>), GetXamlTypeByName("Object"));
AddToMapOfTypeToStandardName(typeof(global::BindRadioButtonsToEnums.Converters.EnumToBooleanConverter<global::BindRadioButtonsToEnums.Models.TransportationMode>),
"BindRadioButtonsToEnums.Converters.EnumToBooleanConverter<BindRadioButtonsToEnums.Models.TransportationMode>");
userType.Activator = Activate_1_EnumToBooleanConverter;
xamlType = userType;
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel3":
userType = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType(this, typeName, typeof(global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel3), GetXamlTypeByName("BindRadioButtonsToEnums.Common.BindableBase"));
userType.Activator = Activate_2_JourneyViewModel3;
userType.AddMemberName("SelectedTransportationMode");
userType.AddMemberName("EstimatedDuration");
AddToMapOfTypeToStandardName(typeof(global::System.String),
"String");
userType.AddMemberName("GoByBicycleCommand");
xamlType = userType;
break;
case "BindRadioButtonsToEnums.Common.BindableBase":
userType = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType(this, typeName, typeof(global::BindRadioButtonsToEnums.Common.BindableBase), GetXamlTypeByName("Object"));
xamlType = userType;
break;
case "BindRadioButtonsToEnums.Models.TransportationMode":
userType = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType(this, typeName, typeof(global::BindRadioButtonsToEnums.Models.TransportationMode), GetXamlTypeByName("System.Enum"));
userType.AddEnumValue("Car", global::BindRadioButtonsToEnums.Models.TransportationMode.Car);
userType.AddEnumValue("Bicycle", global::BindRadioButtonsToEnums.Models.TransportationMode.Bicycle);
userType.AddEnumValue("Train", global::BindRadioButtonsToEnums.Models.TransportationMode.Train);
userType.AddEnumValue("Boat", global::BindRadioButtonsToEnums.Models.TransportationMode.Boat);
userType.AddEnumValue("Rickshaw", global::BindRadioButtonsToEnums.Models.TransportationMode.Rickshaw);
userType.AddEnumValue("Hovercraft", global::BindRadioButtonsToEnums.Models.TransportationMode.Hovercraft);
xamlType = userType;
break;
case "System.Enum":
userType = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType(this, typeName, typeof(global::System.Enum), GetXamlTypeByName("System.ValueType"));
xamlType = userType;
break;
case "System.ValueType":
userType = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType(this, typeName, typeof(global::System.ValueType), GetXamlTypeByName("Object"));
xamlType = userType;
break;
case "System.Windows.Input.ICommand":
userType = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType(this, typeName, typeof(global::System.Windows.Input.ICommand), null);
xamlType = userType;
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel2":
userType = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType(this, typeName, typeof(global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel2), GetXamlTypeByName("BindRadioButtonsToEnums.Common.BindableBase"));
userType.Activator = Activate_8_JourneyViewModel2;
userType.AddMemberName("SelectedTransportationMode");
userType.AddMemberName("IsCar");
AddToMapOfTypeToStandardName(typeof(global::System.Boolean),
"Boolean");
userType.AddMemberName("IsBicycle");
AddToMapOfTypeToStandardName(typeof(global::System.Boolean),
"Boolean");
userType.AddMemberName("IsTrain");
AddToMapOfTypeToStandardName(typeof(global::System.Boolean),
"Boolean");
userType.AddMemberName("IsBoat");
AddToMapOfTypeToStandardName(typeof(global::System.Boolean),
"Boolean");
userType.AddMemberName("IsRickshaw");
AddToMapOfTypeToStandardName(typeof(global::System.Boolean),
"Boolean");
userType.AddMemberName("IsHovercraft");
AddToMapOfTypeToStandardName(typeof(global::System.Boolean),
"Boolean");
userType.AddMemberName("EstimatedDuration");
AddToMapOfTypeToStandardName(typeof(global::System.String),
"String");
userType.AddMemberName("GoByBicycleCommand");
xamlType = userType;
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel1":
userType = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType(this, typeName, typeof(global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel1), GetXamlTypeByName("BindRadioButtonsToEnums.Common.BindableBase"));
userType.Activator = Activate_9_JourneyViewModel1;
userType.AddMemberName("AvailableTransportationModes");
AddToMapOfTypeToStandardName(typeof(global::System.Collections.Generic.IEnumerable<global::BindRadioButtonsToEnums.Models.TransportationMode>),
"System.Collections.Generic.IEnumerable<BindRadioButtonsToEnums.Models.TransportationMode>");
userType.AddMemberName("SelectedTransportationMode");
userType.AddMemberName("EstimatedDuration");
AddToMapOfTypeToStandardName(typeof(global::System.String),
"String");
userType.AddMemberName("GoByBicycleCommand");
xamlType = userType;
break;
case "System.Collections.Generic.IEnumerable<BindRadioButtonsToEnums.Models.TransportationMode>":
userType = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType(this, typeName, typeof(global::System.Collections.Generic.IEnumerable<global::BindRadioButtonsToEnums.Models.TransportationMode>), null);
AddToMapOfTypeToStandardName(typeof(global::System.Collections.Generic.IEnumerable<global::BindRadioButtonsToEnums.Models.TransportationMode>),
"System.Collections.Generic.IEnumerable<BindRadioButtonsToEnums.Models.TransportationMode>");
xamlType = userType;
break;
case "BindRadioButtonsToEnums.MainPage":
userType = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType(this, typeName, typeof(global::BindRadioButtonsToEnums.MainPage), GetXamlTypeByName("Windows.UI.Xaml.Controls.Page"));
userType.Activator = Activate_11_MainPage;
xamlType = userType;
break;
}
return xamlType;
}
private object get_0_JourneyViewModel3_SelectedTransportationMode(object instance)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel3)instance;
return that.SelectedTransportationMode;
}
private void set_0_JourneyViewModel3_SelectedTransportationMode(object instance, object Value)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel3)instance;
that.SelectedTransportationMode = (global::BindRadioButtonsToEnums.Models.TransportationMode)Value;
}
private object get_1_JourneyViewModel3_EstimatedDuration(object instance)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel3)instance;
return that.EstimatedDuration;
}
private object get_2_JourneyViewModel3_GoByBicycleCommand(object instance)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel3)instance;
return that.GoByBicycleCommand;
}
private object get_3_JourneyViewModel2_SelectedTransportationMode(object instance)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel2)instance;
return that.SelectedTransportationMode;
}
private void set_3_JourneyViewModel2_SelectedTransportationMode(object instance, object Value)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel2)instance;
that.SelectedTransportationMode = (global::BindRadioButtonsToEnums.Models.TransportationMode)Value;
}
private object get_4_JourneyViewModel2_IsCar(object instance)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel2)instance;
return that.IsCar;
}
private void set_4_JourneyViewModel2_IsCar(object instance, object Value)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel2)instance;
that.IsCar = (global::System.Boolean)Value;
}
private object get_5_JourneyViewModel2_IsBicycle(object instance)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel2)instance;
return that.IsBicycle;
}
private void set_5_JourneyViewModel2_IsBicycle(object instance, object Value)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel2)instance;
that.IsBicycle = (global::System.Boolean)Value;
}
private object get_6_JourneyViewModel2_IsTrain(object instance)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel2)instance;
return that.IsTrain;
}
private void set_6_JourneyViewModel2_IsTrain(object instance, object Value)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel2)instance;
that.IsTrain = (global::System.Boolean)Value;
}
private object get_7_JourneyViewModel2_IsBoat(object instance)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel2)instance;
return that.IsBoat;
}
private void set_7_JourneyViewModel2_IsBoat(object instance, object Value)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel2)instance;
that.IsBoat = (global::System.Boolean)Value;
}
private object get_8_JourneyViewModel2_IsRickshaw(object instance)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel2)instance;
return that.IsRickshaw;
}
private void set_8_JourneyViewModel2_IsRickshaw(object instance, object Value)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel2)instance;
that.IsRickshaw = (global::System.Boolean)Value;
}
private object get_9_JourneyViewModel2_IsHovercraft(object instance)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel2)instance;
return that.IsHovercraft;
}
private void set_9_JourneyViewModel2_IsHovercraft(object instance, object Value)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel2)instance;
that.IsHovercraft = (global::System.Boolean)Value;
}
private object get_10_JourneyViewModel2_EstimatedDuration(object instance)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel2)instance;
return that.EstimatedDuration;
}
private object get_11_JourneyViewModel2_GoByBicycleCommand(object instance)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel2)instance;
return that.GoByBicycleCommand;
}
private object get_12_JourneyViewModel1_AvailableTransportationModes(object instance)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel1)instance;
return that.AvailableTransportationModes;
}
private object get_13_JourneyViewModel1_SelectedTransportationMode(object instance)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel1)instance;
return that.SelectedTransportationMode;
}
private void set_13_JourneyViewModel1_SelectedTransportationMode(object instance, object Value)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel1)instance;
that.SelectedTransportationMode = (global::BindRadioButtonsToEnums.Models.TransportationMode)Value;
}
private object get_14_JourneyViewModel1_EstimatedDuration(object instance)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel1)instance;
return that.EstimatedDuration;
}
private object get_15_JourneyViewModel1_GoByBicycleCommand(object instance)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel1)instance;
return that.GoByBicycleCommand;
}
private global::Windows.UI.Xaml.Markup.IXamlMember CreateXamlMember(string longMemberName)
{
global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlMember xamlMember = null;
global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType userType;
switch (longMemberName)
{
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel3.SelectedTransportationMode":
userType = (global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType)GetXamlTypeByName("BindRadioButtonsToEnums.ViewModels.JourneyViewModel3");
xamlMember = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlMember(this, "SelectedTransportationMode", "BindRadioButtonsToEnums.Models.TransportationMode");
xamlMember.Getter = get_0_JourneyViewModel3_SelectedTransportationMode;
xamlMember.Setter = set_0_JourneyViewModel3_SelectedTransportationMode;
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel3.EstimatedDuration":
userType = (global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType)GetXamlTypeByName("BindRadioButtonsToEnums.ViewModels.JourneyViewModel3");
xamlMember = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlMember(this, "EstimatedDuration", "String");
xamlMember.Getter = get_1_JourneyViewModel3_EstimatedDuration;
xamlMember.SetIsReadOnly();
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel3.GoByBicycleCommand":
userType = (global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType)GetXamlTypeByName("BindRadioButtonsToEnums.ViewModels.JourneyViewModel3");
xamlMember = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlMember(this, "GoByBicycleCommand", "System.Windows.Input.ICommand");
xamlMember.Getter = get_2_JourneyViewModel3_GoByBicycleCommand;
xamlMember.SetIsReadOnly();
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel2.SelectedTransportationMode":
userType = (global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType)GetXamlTypeByName("BindRadioButtonsToEnums.ViewModels.JourneyViewModel2");
xamlMember = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlMember(this, "SelectedTransportationMode", "BindRadioButtonsToEnums.Models.TransportationMode");
xamlMember.Getter = get_3_JourneyViewModel2_SelectedTransportationMode;
xamlMember.Setter = set_3_JourneyViewModel2_SelectedTransportationMode;
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel2.IsCar":
userType = (global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType)GetXamlTypeByName("BindRadioButtonsToEnums.ViewModels.JourneyViewModel2");
xamlMember = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlMember(this, "IsCar", "Boolean");
xamlMember.Getter = get_4_JourneyViewModel2_IsCar;
xamlMember.Setter = set_4_JourneyViewModel2_IsCar;
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel2.IsBicycle":
userType = (global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType)GetXamlTypeByName("BindRadioButtonsToEnums.ViewModels.JourneyViewModel2");
xamlMember = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlMember(this, "IsBicycle", "Boolean");
xamlMember.Getter = get_5_JourneyViewModel2_IsBicycle;
xamlMember.Setter = set_5_JourneyViewModel2_IsBicycle;
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel2.IsTrain":
userType = (global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType)GetXamlTypeByName("BindRadioButtonsToEnums.ViewModels.JourneyViewModel2");
xamlMember = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlMember(this, "IsTrain", "Boolean");
xamlMember.Getter = get_6_JourneyViewModel2_IsTrain;
xamlMember.Setter = set_6_JourneyViewModel2_IsTrain;
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel2.IsBoat":
userType = (global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType)GetXamlTypeByName("BindRadioButtonsToEnums.ViewModels.JourneyViewModel2");
xamlMember = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlMember(this, "IsBoat", "Boolean");
xamlMember.Getter = get_7_JourneyViewModel2_IsBoat;
xamlMember.Setter = set_7_JourneyViewModel2_IsBoat;
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel2.IsRickshaw":
userType = (global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType)GetXamlTypeByName("BindRadioButtonsToEnums.ViewModels.JourneyViewModel2");
xamlMember = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlMember(this, "IsRickshaw", "Boolean");
xamlMember.Getter = get_8_JourneyViewModel2_IsRickshaw;
xamlMember.Setter = set_8_JourneyViewModel2_IsRickshaw;
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel2.IsHovercraft":
userType = (global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType)GetXamlTypeByName("BindRadioButtonsToEnums.ViewModels.JourneyViewModel2");
xamlMember = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlMember(this, "IsHovercraft", "Boolean");
xamlMember.Getter = get_9_JourneyViewModel2_IsHovercraft;
xamlMember.Setter = set_9_JourneyViewModel2_IsHovercraft;
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel2.EstimatedDuration":
userType = (global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType)GetXamlTypeByName("BindRadioButtonsToEnums.ViewModels.JourneyViewModel2");
xamlMember = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlMember(this, "EstimatedDuration", "String");
xamlMember.Getter = get_10_JourneyViewModel2_EstimatedDuration;
xamlMember.SetIsReadOnly();
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel2.GoByBicycleCommand":
userType = (global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType)GetXamlTypeByName("BindRadioButtonsToEnums.ViewModels.JourneyViewModel2");
xamlMember = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlMember(this, "GoByBicycleCommand", "System.Windows.Input.ICommand");
xamlMember.Getter = get_11_JourneyViewModel2_GoByBicycleCommand;
xamlMember.SetIsReadOnly();
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel1.AvailableTransportationModes":
userType = (global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType)GetXamlTypeByName("BindRadioButtonsToEnums.ViewModels.JourneyViewModel1");
xamlMember = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlMember(this, "AvailableTransportationModes", "System.Collections.Generic.IEnumerable<BindRadioButtonsToEnums.Models.TransportationMode>");
xamlMember.Getter = get_12_JourneyViewModel1_AvailableTransportationModes;
xamlMember.SetIsReadOnly();
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel1.SelectedTransportationMode":
userType = (global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType)GetXamlTypeByName("BindRadioButtonsToEnums.ViewModels.JourneyViewModel1");
xamlMember = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlMember(this, "SelectedTransportationMode", "BindRadioButtonsToEnums.Models.TransportationMode");
xamlMember.Getter = get_13_JourneyViewModel1_SelectedTransportationMode;
xamlMember.Setter = set_13_JourneyViewModel1_SelectedTransportationMode;
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel1.EstimatedDuration":
userType = (global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType)GetXamlTypeByName("BindRadioButtonsToEnums.ViewModels.JourneyViewModel1");
xamlMember = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlMember(this, "EstimatedDuration", "String");
xamlMember.Getter = get_14_JourneyViewModel1_EstimatedDuration;
xamlMember.SetIsReadOnly();
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel1.GoByBicycleCommand":
userType = (global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType)GetXamlTypeByName("BindRadioButtonsToEnums.ViewModels.JourneyViewModel1");
xamlMember = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlMember(this, "GoByBicycleCommand", "System.Windows.Input.ICommand");
xamlMember.Getter = get_15_JourneyViewModel1_GoByBicycleCommand;
xamlMember.SetIsReadOnly();
break;
}
return xamlMember;
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks", "4.0.0.0")]
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
internal class XamlSystemBaseType : global::Windows.UI.Xaml.Markup.IXamlType
{
string _fullName;
global::System.Type _underlyingType;
public XamlSystemBaseType(string fullName, global::System.Type underlyingType)
{
_fullName = fullName;
_underlyingType = underlyingType;
}
public string FullName { get { return _fullName; } }
public global::System.Type UnderlyingType
{
get
{
return _underlyingType;
}
}
virtual public global::Windows.UI.Xaml.Markup.IXamlType BaseType { get { throw new global::System.NotImplementedException(); } }
virtual public global::Windows.UI.Xaml.Markup.IXamlMember ContentProperty { get { throw new global::System.NotImplementedException(); } }
virtual public global::Windows.UI.Xaml.Markup.IXamlMember GetMember(string name) { throw new global::System.NotImplementedException(); }
virtual public bool IsArray { get { throw new global::System.NotImplementedException(); } }
virtual public bool IsCollection { get { throw new global::System.NotImplementedException(); } }
virtual public bool IsConstructible { get { throw new global::System.NotImplementedException(); } }
virtual public bool IsDictionary { get { throw new global::System.NotImplementedException(); } }
virtual public bool IsMarkupExtension { get { throw new global::System.NotImplementedException(); } }
virtual public bool IsBindable { get { throw new global::System.NotImplementedException(); } }
virtual public global::Windows.UI.Xaml.Markup.IXamlType ItemType { get { throw new global::System.NotImplementedException(); } }
virtual public global::Windows.UI.Xaml.Markup.IXamlType KeyType { get { throw new global::System.NotImplementedException(); } }
virtual public object ActivateInstance() { throw new global::System.NotImplementedException(); }
virtual public void AddToMap(object instance, object key, object item) { throw new global::System.NotImplementedException(); }
virtual public void AddToVector(object instance, object item) { throw new global::System.NotImplementedException(); }
virtual public void RunInitializer() { throw new global::System.NotImplementedException(); }
virtual public object CreateFromString(global::System.String input) { throw new global::System.NotImplementedException(); }
}
internal delegate object Activator();
internal delegate void AddToCollection(object instance, object item);
internal delegate void AddToDictionary(object instance, object key, object item);
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks", "4.0.0.0")]
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
internal class XamlUserType : global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlSystemBaseType
{
global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlTypeInfoProvider _provider;
global::Windows.UI.Xaml.Markup.IXamlType _baseType;
bool _isArray;
bool _isMarkupExtension;
bool _isBindable;
string _contentPropertyName;
string _itemTypeName;
string _keyTypeName;
global::System.Collections.Generic.Dictionary<string, string> _memberNames;
global::System.Collections.Generic.Dictionary<string, object> _enumValues;
public XamlUserType(global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlTypeInfoProvider provider, string fullName, global::System.Type fullType, global::Windows.UI.Xaml.Markup.IXamlType baseType)
:base(fullName, fullType)
{
_provider = provider;
_baseType = baseType;
}
// --- Interface methods ----
override public global::Windows.UI.Xaml.Markup.IXamlType BaseType { get { return _baseType; } }
override public bool IsArray { get { return _isArray; } }
override public bool IsCollection { get { return (CollectionAdd != null); } }
override public bool IsConstructible { get { return (Activator != null); } }
override public bool IsDictionary { get { return (DictionaryAdd != null); } }
override public bool IsMarkupExtension { get { return _isMarkupExtension; } }
override public bool IsBindable { get { return _isBindable; } }
override public global::Windows.UI.Xaml.Markup.IXamlMember ContentProperty
{
get { return _provider.GetMemberByLongName(_contentPropertyName); }
}
override public global::Windows.UI.Xaml.Markup.IXamlType ItemType
{
get { return _provider.GetXamlTypeByName(_itemTypeName); }
}
override public global::Windows.UI.Xaml.Markup.IXamlType KeyType
{
get { return _provider.GetXamlTypeByName(_keyTypeName); }
}
override public global::Windows.UI.Xaml.Markup.IXamlMember GetMember(string name)
{
if (_memberNames == null)
{
return null;
}
string longName;
if (_memberNames.TryGetValue(name, out longName))
{
return _provider.GetMemberByLongName(longName);
}
return null;
}
override public object ActivateInstance()
{
return Activator();
}
override public void AddToMap(object instance, object key, object item)
{
DictionaryAdd(instance, key, item);
}
override public void AddToVector(object instance, object item)
{
CollectionAdd(instance, item);
}
override public void RunInitializer()
{
System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(UnderlyingType.TypeHandle);
}
override public global::System.Object CreateFromString(global::System.String input)
{
if (_enumValues != null)
{
global::System.Int32 value = 0;
string[] valueParts = input.Split(',');
foreach (string valuePart in valueParts)
{
object partValue;
global::System.Int32 enumFieldValue = 0;
try
{
if (_enumValues.TryGetValue(valuePart.Trim(), out partValue))
{
enumFieldValue = global::System.Convert.ToInt32(partValue);
}
else
{
try
{
enumFieldValue = global::System.Convert.ToInt32(valuePart.Trim());
}
catch( global::System.FormatException )
{
foreach( string key in _enumValues.Keys )
{
if( global::System.String.Compare(valuePart.Trim(), key, global::System.StringComparison.OrdinalIgnoreCase) == 0 )
{
if( _enumValues.TryGetValue(key.Trim(), out partValue) )
{
enumFieldValue = global::System.Convert.ToInt32(partValue);
break;
}
}
}
}
}
value |= enumFieldValue;
}
catch( global::System.FormatException )
{
throw new global::System.ArgumentException(input, FullName);
}
}
return value;
}
throw new global::System.ArgumentException(input, FullName);
}
// --- End of Interface methods
public Activator Activator { get; set; }
public AddToCollection CollectionAdd { get; set; }
public AddToDictionary DictionaryAdd { get; set; }
public void SetContentPropertyName(string contentPropertyName)
{
_contentPropertyName = contentPropertyName;
}
public void SetIsArray()
{
_isArray = true;
}
public void SetIsMarkupExtension()
{
_isMarkupExtension = true;
}
public void SetIsBindable()
{
_isBindable = true;
}
public void SetItemTypeName(string itemTypeName)
{
_itemTypeName = itemTypeName;
}
public void SetKeyTypeName(string keyTypeName)
{
_keyTypeName = keyTypeName;
}
public void AddMemberName(string shortName)
{
if(_memberNames == null)
{
_memberNames = new global::System.Collections.Generic.Dictionary<string,string>();
}
_memberNames.Add(shortName, FullName + "." + shortName);
}
public void AddEnumValue(string name, object value)
{
if (_enumValues == null)
{
_enumValues = new global::System.Collections.Generic.Dictionary<string, object>();
}
_enumValues.Add(name, value);
}
}
internal delegate object Getter(object instance);
internal delegate void Setter(object instance, object value);
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks", "4.0.0.0")]
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
internal class XamlMember : global::Windows.UI.Xaml.Markup.IXamlMember
{
global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlTypeInfoProvider _provider;
string _name;
bool _isAttachable;
bool _isDependencyProperty;
bool _isReadOnly;
string _typeName;
string _targetTypeName;
public XamlMember(global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlTypeInfoProvider provider, string name, string typeName)
{
_name = name;
_typeName = typeName;
_provider = provider;
}
public string Name { get { return _name; } }
public global::Windows.UI.Xaml.Markup.IXamlType Type
{
get { return _provider.GetXamlTypeByName(_typeName); }
}
public void SetTargetTypeName(global::System.String targetTypeName)
{
_targetTypeName = targetTypeName;
}
public global::Windows.UI.Xaml.Markup.IXamlType TargetType
{
get { return _provider.GetXamlTypeByName(_targetTypeName); }
}
public void SetIsAttachable() { _isAttachable = true; }
public bool IsAttachable { get { return _isAttachable; } }
public void SetIsDependencyProperty() { _isDependencyProperty = true; }
public bool IsDependencyProperty { get { return _isDependencyProperty; } }
public void SetIsReadOnly() { _isReadOnly = true; }
public bool IsReadOnly { get { return _isReadOnly; } }
public Getter Getter { get; set; }
public object GetValue(object instance)
{
if (Getter != null)
return Getter(instance);
else
throw new global::System.InvalidOperationException("GetValue");
}
public Setter Setter { get; set; }
public void SetValue(object instance, object value)
{
if (Setter != null)
Setter(instance, value);
else
throw new global::System.InvalidOperationException("SetValue");
}
}
}

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

@ -0,0 +1,867 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace BindRadioButtonsToEnums
{
public partial class App : global::Windows.UI.Xaml.Markup.IXamlMetadataProvider
{
private global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlTypeInfoProvider _provider;
public global::Windows.UI.Xaml.Markup.IXamlType GetXamlType(global::System.Type type)
{
if(_provider == null)
{
_provider = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlTypeInfoProvider();
}
return _provider.GetXamlTypeByType(type);
}
public global::Windows.UI.Xaml.Markup.IXamlType GetXamlType(global::System.String fullName)
{
if(_provider == null)
{
_provider = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlTypeInfoProvider();
}
return _provider.GetXamlTypeByName(fullName);
}
public global::Windows.UI.Xaml.Markup.XmlnsDefinition[] GetXmlnsDefinitions()
{
return new global::Windows.UI.Xaml.Markup.XmlnsDefinition[0];
}
}
}
namespace BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo
{
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks", "4.0.0.0")]
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
internal partial class XamlTypeInfoProvider
{
public global::Windows.UI.Xaml.Markup.IXamlType GetXamlTypeByType(global::System.Type type)
{
string standardName;
global::Windows.UI.Xaml.Markup.IXamlType xamlType = null;
if(_xamlTypeToStandardName.TryGetValue(type, out standardName))
{
xamlType = GetXamlTypeByName(standardName);
}
else
{
xamlType = GetXamlTypeByName(type.FullName);
}
return xamlType;
}
public global::Windows.UI.Xaml.Markup.IXamlType GetXamlTypeByName(string typeName)
{
if (global::System.String.IsNullOrEmpty(typeName))
{
return null;
}
global::Windows.UI.Xaml.Markup.IXamlType xamlType;
if (_xamlTypes.TryGetValue(typeName, out xamlType))
{
return xamlType;
}
xamlType = CreateXamlType(typeName);
if (xamlType != null)
{
_xamlTypes.Add(typeName, xamlType);
}
return xamlType;
}
public global::Windows.UI.Xaml.Markup.IXamlMember GetMemberByLongName(string longMemberName)
{
if (global::System.String.IsNullOrEmpty(longMemberName))
{
return null;
}
global::Windows.UI.Xaml.Markup.IXamlMember xamlMember;
if (_xamlMembers.TryGetValue(longMemberName, out xamlMember))
{
return xamlMember;
}
xamlMember = CreateXamlMember(longMemberName);
if (xamlMember != null)
{
_xamlMembers.Add(longMemberName, xamlMember);
}
return xamlMember;
}
global::System.Collections.Generic.Dictionary<string, global::Windows.UI.Xaml.Markup.IXamlType> _xamlTypes = new global::System.Collections.Generic.Dictionary<string, global::Windows.UI.Xaml.Markup.IXamlType>();
global::System.Collections.Generic.Dictionary<string, global::Windows.UI.Xaml.Markup.IXamlMember> _xamlMembers = new global::System.Collections.Generic.Dictionary<string, global::Windows.UI.Xaml.Markup.IXamlMember>();
global::System.Collections.Generic.Dictionary<global::System.Type, string> _xamlTypeToStandardName = new global::System.Collections.Generic.Dictionary<global::System.Type, string>();
private void AddToMapOfTypeToStandardName(global::System.Type t, global::System.String str)
{
if(!_xamlTypeToStandardName.ContainsKey(t))
{
_xamlTypeToStandardName.Add(t, str);
}
}
private object Activate_0_TransportationModeToBooleanConverter() { return new global::BindRadioButtonsToEnums.Converters.TransportationModeToBooleanConverter(); }
private object Activate_1_EnumToBooleanConverter() { return new global::BindRadioButtonsToEnums.Converters.EnumToBooleanConverter<global::BindRadioButtonsToEnums.Models.TransportationMode>(); }
private object Activate_2_JourneyViewModel4() { return new global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel4(); }
private object Activate_6_JourneyViewModel3() { return new global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel3(); }
private object Activate_10_JourneyViewModel2() { return new global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel2(); }
private object Activate_11_JourneyViewModel1() { return new global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel1(); }
private object Activate_13_MainPage() { return new global::BindRadioButtonsToEnums.MainPage(); }
private global::Windows.UI.Xaml.Markup.IXamlType CreateXamlType(string typeName)
{
global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlSystemBaseType xamlType = null;
global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType userType;
switch (typeName)
{
case "Object":
xamlType = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlSystemBaseType(typeName, typeof(global::System.Object));
break;
case "String":
xamlType = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlSystemBaseType(typeName, typeof(global::System.String));
break;
case "Boolean":
xamlType = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlSystemBaseType(typeName, typeof(global::System.Boolean));
break;
case "Windows.UI.Xaml.Controls.Page":
xamlType = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlSystemBaseType(typeName, typeof(global::Windows.UI.Xaml.Controls.Page));
break;
case "Windows.UI.Xaml.Controls.UserControl":
xamlType = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlSystemBaseType(typeName, typeof(global::Windows.UI.Xaml.Controls.UserControl));
break;
case "BindRadioButtonsToEnums.Converters.TransportationModeToBooleanConverter":
userType = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType(this, typeName, typeof(global::BindRadioButtonsToEnums.Converters.TransportationModeToBooleanConverter), GetXamlTypeByName("BindRadioButtonsToEnums.Converters.EnumToBooleanConverter<BindRadioButtonsToEnums.Models.TransportationMode>"));
userType.Activator = Activate_0_TransportationModeToBooleanConverter;
xamlType = userType;
break;
case "BindRadioButtonsToEnums.Converters.EnumToBooleanConverter<BindRadioButtonsToEnums.Models.TransportationMode>":
userType = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType(this, typeName, typeof(global::BindRadioButtonsToEnums.Converters.EnumToBooleanConverter<global::BindRadioButtonsToEnums.Models.TransportationMode>), GetXamlTypeByName("Object"));
AddToMapOfTypeToStandardName(typeof(global::BindRadioButtonsToEnums.Converters.EnumToBooleanConverter<global::BindRadioButtonsToEnums.Models.TransportationMode>),
"BindRadioButtonsToEnums.Converters.EnumToBooleanConverter<BindRadioButtonsToEnums.Models.TransportationMode>");
userType.Activator = Activate_1_EnumToBooleanConverter;
xamlType = userType;
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel4":
userType = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType(this, typeName, typeof(global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel4), GetXamlTypeByName("BindRadioButtonsToEnums.Common.BindableBase"));
userType.Activator = Activate_2_JourneyViewModel4;
userType.AddMemberName("SelectedTransportationMode");
AddToMapOfTypeToStandardName(typeof(global::BindRadioButtonsToEnums.Helpers.BindableEnum<global::BindRadioButtonsToEnums.Models.TransportationMode>),
"BindRadioButtonsToEnums.Helpers.BindableEnum<BindRadioButtonsToEnums.Models.TransportationMode>");
userType.AddMemberName("EstimatedDuration");
AddToMapOfTypeToStandardName(typeof(global::System.String),
"String");
userType.AddMemberName("GoByBicycleCommand");
xamlType = userType;
break;
case "BindRadioButtonsToEnums.Common.BindableBase":
userType = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType(this, typeName, typeof(global::BindRadioButtonsToEnums.Common.BindableBase), GetXamlTypeByName("Object"));
xamlType = userType;
break;
case "BindRadioButtonsToEnums.Helpers.BindableEnum<BindRadioButtonsToEnums.Models.TransportationMode>":
userType = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType(this, typeName, typeof(global::BindRadioButtonsToEnums.Helpers.BindableEnum<global::BindRadioButtonsToEnums.Models.TransportationMode>), GetXamlTypeByName("BindRadioButtonsToEnums.Common.BindableBase"));
AddToMapOfTypeToStandardName(typeof(global::BindRadioButtonsToEnums.Helpers.BindableEnum<global::BindRadioButtonsToEnums.Models.TransportationMode>),
"BindRadioButtonsToEnums.Helpers.BindableEnum<BindRadioButtonsToEnums.Models.TransportationMode>");
xamlType = userType;
break;
case "System.Windows.Input.ICommand":
userType = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType(this, typeName, typeof(global::System.Windows.Input.ICommand), null);
xamlType = userType;
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel3":
userType = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType(this, typeName, typeof(global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel3), GetXamlTypeByName("BindRadioButtonsToEnums.Common.BindableBase"));
userType.Activator = Activate_6_JourneyViewModel3;
userType.AddMemberName("SelectedTransportationMode");
userType.AddMemberName("EstimatedDuration");
AddToMapOfTypeToStandardName(typeof(global::System.String),
"String");
userType.AddMemberName("GoByBicycleCommand");
xamlType = userType;
break;
case "BindRadioButtonsToEnums.Models.TransportationMode":
userType = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType(this, typeName, typeof(global::BindRadioButtonsToEnums.Models.TransportationMode), GetXamlTypeByName("System.Enum"));
userType.AddEnumValue("Car", global::BindRadioButtonsToEnums.Models.TransportationMode.Car);
userType.AddEnumValue("Bicycle", global::BindRadioButtonsToEnums.Models.TransportationMode.Bicycle);
userType.AddEnumValue("Train", global::BindRadioButtonsToEnums.Models.TransportationMode.Train);
userType.AddEnumValue("Boat", global::BindRadioButtonsToEnums.Models.TransportationMode.Boat);
userType.AddEnumValue("Rickshaw", global::BindRadioButtonsToEnums.Models.TransportationMode.Rickshaw);
userType.AddEnumValue("Hovercraft", global::BindRadioButtonsToEnums.Models.TransportationMode.Hovercraft);
xamlType = userType;
break;
case "System.Enum":
userType = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType(this, typeName, typeof(global::System.Enum), GetXamlTypeByName("System.ValueType"));
xamlType = userType;
break;
case "System.ValueType":
userType = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType(this, typeName, typeof(global::System.ValueType), GetXamlTypeByName("Object"));
xamlType = userType;
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel2":
userType = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType(this, typeName, typeof(global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel2), GetXamlTypeByName("BindRadioButtonsToEnums.Common.BindableBase"));
userType.Activator = Activate_10_JourneyViewModel2;
userType.AddMemberName("SelectedTransportationMode");
userType.AddMemberName("IsCar");
AddToMapOfTypeToStandardName(typeof(global::System.Boolean),
"Boolean");
userType.AddMemberName("IsBicycle");
AddToMapOfTypeToStandardName(typeof(global::System.Boolean),
"Boolean");
userType.AddMemberName("IsTrain");
AddToMapOfTypeToStandardName(typeof(global::System.Boolean),
"Boolean");
userType.AddMemberName("IsBoat");
AddToMapOfTypeToStandardName(typeof(global::System.Boolean),
"Boolean");
userType.AddMemberName("IsRickshaw");
AddToMapOfTypeToStandardName(typeof(global::System.Boolean),
"Boolean");
userType.AddMemberName("IsHovercraft");
AddToMapOfTypeToStandardName(typeof(global::System.Boolean),
"Boolean");
userType.AddMemberName("EstimatedDuration");
AddToMapOfTypeToStandardName(typeof(global::System.String),
"String");
userType.AddMemberName("GoByBicycleCommand");
xamlType = userType;
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel1":
userType = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType(this, typeName, typeof(global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel1), GetXamlTypeByName("BindRadioButtonsToEnums.Common.BindableBase"));
userType.Activator = Activate_11_JourneyViewModel1;
userType.AddMemberName("AvailableTransportationModes");
AddToMapOfTypeToStandardName(typeof(global::System.Collections.Generic.IEnumerable<global::BindRadioButtonsToEnums.Models.TransportationMode>),
"System.Collections.Generic.IEnumerable<BindRadioButtonsToEnums.Models.TransportationMode>");
userType.AddMemberName("SelectedTransportationMode");
userType.AddMemberName("EstimatedDuration");
AddToMapOfTypeToStandardName(typeof(global::System.String),
"String");
userType.AddMemberName("GoByBicycleCommand");
xamlType = userType;
break;
case "System.Collections.Generic.IEnumerable<BindRadioButtonsToEnums.Models.TransportationMode>":
userType = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType(this, typeName, typeof(global::System.Collections.Generic.IEnumerable<global::BindRadioButtonsToEnums.Models.TransportationMode>), null);
AddToMapOfTypeToStandardName(typeof(global::System.Collections.Generic.IEnumerable<global::BindRadioButtonsToEnums.Models.TransportationMode>),
"System.Collections.Generic.IEnumerable<BindRadioButtonsToEnums.Models.TransportationMode>");
xamlType = userType;
break;
case "BindRadioButtonsToEnums.MainPage":
userType = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType(this, typeName, typeof(global::BindRadioButtonsToEnums.MainPage), GetXamlTypeByName("Windows.UI.Xaml.Controls.Page"));
userType.Activator = Activate_13_MainPage;
xamlType = userType;
break;
}
return xamlType;
}
private object get_0_JourneyViewModel4_SelectedTransportationMode(object instance)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel4)instance;
return that.SelectedTransportationMode;
}
private object get_1_JourneyViewModel4_EstimatedDuration(object instance)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel4)instance;
return that.EstimatedDuration;
}
private object get_2_JourneyViewModel4_GoByBicycleCommand(object instance)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel4)instance;
return that.GoByBicycleCommand;
}
private object get_3_JourneyViewModel3_SelectedTransportationMode(object instance)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel3)instance;
return that.SelectedTransportationMode;
}
private void set_3_JourneyViewModel3_SelectedTransportationMode(object instance, object Value)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel3)instance;
that.SelectedTransportationMode = (global::BindRadioButtonsToEnums.Models.TransportationMode)Value;
}
private object get_4_JourneyViewModel3_EstimatedDuration(object instance)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel3)instance;
return that.EstimatedDuration;
}
private object get_5_JourneyViewModel3_GoByBicycleCommand(object instance)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel3)instance;
return that.GoByBicycleCommand;
}
private object get_6_JourneyViewModel2_SelectedTransportationMode(object instance)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel2)instance;
return that.SelectedTransportationMode;
}
private void set_6_JourneyViewModel2_SelectedTransportationMode(object instance, object Value)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel2)instance;
that.SelectedTransportationMode = (global::BindRadioButtonsToEnums.Models.TransportationMode)Value;
}
private object get_7_JourneyViewModel2_IsCar(object instance)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel2)instance;
return that.IsCar;
}
private void set_7_JourneyViewModel2_IsCar(object instance, object Value)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel2)instance;
that.IsCar = (global::System.Boolean)Value;
}
private object get_8_JourneyViewModel2_IsBicycle(object instance)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel2)instance;
return that.IsBicycle;
}
private void set_8_JourneyViewModel2_IsBicycle(object instance, object Value)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel2)instance;
that.IsBicycle = (global::System.Boolean)Value;
}
private object get_9_JourneyViewModel2_IsTrain(object instance)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel2)instance;
return that.IsTrain;
}
private void set_9_JourneyViewModel2_IsTrain(object instance, object Value)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel2)instance;
that.IsTrain = (global::System.Boolean)Value;
}
private object get_10_JourneyViewModel2_IsBoat(object instance)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel2)instance;
return that.IsBoat;
}
private void set_10_JourneyViewModel2_IsBoat(object instance, object Value)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel2)instance;
that.IsBoat = (global::System.Boolean)Value;
}
private object get_11_JourneyViewModel2_IsRickshaw(object instance)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel2)instance;
return that.IsRickshaw;
}
private void set_11_JourneyViewModel2_IsRickshaw(object instance, object Value)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel2)instance;
that.IsRickshaw = (global::System.Boolean)Value;
}
private object get_12_JourneyViewModel2_IsHovercraft(object instance)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel2)instance;
return that.IsHovercraft;
}
private void set_12_JourneyViewModel2_IsHovercraft(object instance, object Value)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel2)instance;
that.IsHovercraft = (global::System.Boolean)Value;
}
private object get_13_JourneyViewModel2_EstimatedDuration(object instance)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel2)instance;
return that.EstimatedDuration;
}
private object get_14_JourneyViewModel2_GoByBicycleCommand(object instance)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel2)instance;
return that.GoByBicycleCommand;
}
private object get_15_JourneyViewModel1_AvailableTransportationModes(object instance)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel1)instance;
return that.AvailableTransportationModes;
}
private object get_16_JourneyViewModel1_SelectedTransportationMode(object instance)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel1)instance;
return that.SelectedTransportationMode;
}
private void set_16_JourneyViewModel1_SelectedTransportationMode(object instance, object Value)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel1)instance;
that.SelectedTransportationMode = (global::BindRadioButtonsToEnums.Models.TransportationMode)Value;
}
private object get_17_JourneyViewModel1_EstimatedDuration(object instance)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel1)instance;
return that.EstimatedDuration;
}
private object get_18_JourneyViewModel1_GoByBicycleCommand(object instance)
{
var that = (global::BindRadioButtonsToEnums.ViewModels.JourneyViewModel1)instance;
return that.GoByBicycleCommand;
}
private global::Windows.UI.Xaml.Markup.IXamlMember CreateXamlMember(string longMemberName)
{
global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlMember xamlMember = null;
global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType userType;
switch (longMemberName)
{
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel4.SelectedTransportationMode":
userType = (global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType)GetXamlTypeByName("BindRadioButtonsToEnums.ViewModels.JourneyViewModel4");
xamlMember = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlMember(this, "SelectedTransportationMode", "BindRadioButtonsToEnums.Helpers.BindableEnum<BindRadioButtonsToEnums.Models.TransportationMode>");
xamlMember.Getter = get_0_JourneyViewModel4_SelectedTransportationMode;
xamlMember.SetIsReadOnly();
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel4.EstimatedDuration":
userType = (global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType)GetXamlTypeByName("BindRadioButtonsToEnums.ViewModels.JourneyViewModel4");
xamlMember = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlMember(this, "EstimatedDuration", "String");
xamlMember.Getter = get_1_JourneyViewModel4_EstimatedDuration;
xamlMember.SetIsReadOnly();
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel4.GoByBicycleCommand":
userType = (global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType)GetXamlTypeByName("BindRadioButtonsToEnums.ViewModels.JourneyViewModel4");
xamlMember = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlMember(this, "GoByBicycleCommand", "System.Windows.Input.ICommand");
xamlMember.Getter = get_2_JourneyViewModel4_GoByBicycleCommand;
xamlMember.SetIsReadOnly();
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel3.SelectedTransportationMode":
userType = (global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType)GetXamlTypeByName("BindRadioButtonsToEnums.ViewModels.JourneyViewModel3");
xamlMember = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlMember(this, "SelectedTransportationMode", "BindRadioButtonsToEnums.Models.TransportationMode");
xamlMember.Getter = get_3_JourneyViewModel3_SelectedTransportationMode;
xamlMember.Setter = set_3_JourneyViewModel3_SelectedTransportationMode;
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel3.EstimatedDuration":
userType = (global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType)GetXamlTypeByName("BindRadioButtonsToEnums.ViewModels.JourneyViewModel3");
xamlMember = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlMember(this, "EstimatedDuration", "String");
xamlMember.Getter = get_4_JourneyViewModel3_EstimatedDuration;
xamlMember.SetIsReadOnly();
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel3.GoByBicycleCommand":
userType = (global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType)GetXamlTypeByName("BindRadioButtonsToEnums.ViewModels.JourneyViewModel3");
xamlMember = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlMember(this, "GoByBicycleCommand", "System.Windows.Input.ICommand");
xamlMember.Getter = get_5_JourneyViewModel3_GoByBicycleCommand;
xamlMember.SetIsReadOnly();
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel2.SelectedTransportationMode":
userType = (global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType)GetXamlTypeByName("BindRadioButtonsToEnums.ViewModels.JourneyViewModel2");
xamlMember = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlMember(this, "SelectedTransportationMode", "BindRadioButtonsToEnums.Models.TransportationMode");
xamlMember.Getter = get_6_JourneyViewModel2_SelectedTransportationMode;
xamlMember.Setter = set_6_JourneyViewModel2_SelectedTransportationMode;
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel2.IsCar":
userType = (global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType)GetXamlTypeByName("BindRadioButtonsToEnums.ViewModels.JourneyViewModel2");
xamlMember = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlMember(this, "IsCar", "Boolean");
xamlMember.Getter = get_7_JourneyViewModel2_IsCar;
xamlMember.Setter = set_7_JourneyViewModel2_IsCar;
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel2.IsBicycle":
userType = (global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType)GetXamlTypeByName("BindRadioButtonsToEnums.ViewModels.JourneyViewModel2");
xamlMember = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlMember(this, "IsBicycle", "Boolean");
xamlMember.Getter = get_8_JourneyViewModel2_IsBicycle;
xamlMember.Setter = set_8_JourneyViewModel2_IsBicycle;
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel2.IsTrain":
userType = (global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType)GetXamlTypeByName("BindRadioButtonsToEnums.ViewModels.JourneyViewModel2");
xamlMember = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlMember(this, "IsTrain", "Boolean");
xamlMember.Getter = get_9_JourneyViewModel2_IsTrain;
xamlMember.Setter = set_9_JourneyViewModel2_IsTrain;
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel2.IsBoat":
userType = (global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType)GetXamlTypeByName("BindRadioButtonsToEnums.ViewModels.JourneyViewModel2");
xamlMember = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlMember(this, "IsBoat", "Boolean");
xamlMember.Getter = get_10_JourneyViewModel2_IsBoat;
xamlMember.Setter = set_10_JourneyViewModel2_IsBoat;
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel2.IsRickshaw":
userType = (global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType)GetXamlTypeByName("BindRadioButtonsToEnums.ViewModels.JourneyViewModel2");
xamlMember = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlMember(this, "IsRickshaw", "Boolean");
xamlMember.Getter = get_11_JourneyViewModel2_IsRickshaw;
xamlMember.Setter = set_11_JourneyViewModel2_IsRickshaw;
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel2.IsHovercraft":
userType = (global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType)GetXamlTypeByName("BindRadioButtonsToEnums.ViewModels.JourneyViewModel2");
xamlMember = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlMember(this, "IsHovercraft", "Boolean");
xamlMember.Getter = get_12_JourneyViewModel2_IsHovercraft;
xamlMember.Setter = set_12_JourneyViewModel2_IsHovercraft;
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel2.EstimatedDuration":
userType = (global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType)GetXamlTypeByName("BindRadioButtonsToEnums.ViewModels.JourneyViewModel2");
xamlMember = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlMember(this, "EstimatedDuration", "String");
xamlMember.Getter = get_13_JourneyViewModel2_EstimatedDuration;
xamlMember.SetIsReadOnly();
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel2.GoByBicycleCommand":
userType = (global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType)GetXamlTypeByName("BindRadioButtonsToEnums.ViewModels.JourneyViewModel2");
xamlMember = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlMember(this, "GoByBicycleCommand", "System.Windows.Input.ICommand");
xamlMember.Getter = get_14_JourneyViewModel2_GoByBicycleCommand;
xamlMember.SetIsReadOnly();
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel1.AvailableTransportationModes":
userType = (global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType)GetXamlTypeByName("BindRadioButtonsToEnums.ViewModels.JourneyViewModel1");
xamlMember = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlMember(this, "AvailableTransportationModes", "System.Collections.Generic.IEnumerable<BindRadioButtonsToEnums.Models.TransportationMode>");
xamlMember.Getter = get_15_JourneyViewModel1_AvailableTransportationModes;
xamlMember.SetIsReadOnly();
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel1.SelectedTransportationMode":
userType = (global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType)GetXamlTypeByName("BindRadioButtonsToEnums.ViewModels.JourneyViewModel1");
xamlMember = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlMember(this, "SelectedTransportationMode", "BindRadioButtonsToEnums.Models.TransportationMode");
xamlMember.Getter = get_16_JourneyViewModel1_SelectedTransportationMode;
xamlMember.Setter = set_16_JourneyViewModel1_SelectedTransportationMode;
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel1.EstimatedDuration":
userType = (global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType)GetXamlTypeByName("BindRadioButtonsToEnums.ViewModels.JourneyViewModel1");
xamlMember = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlMember(this, "EstimatedDuration", "String");
xamlMember.Getter = get_17_JourneyViewModel1_EstimatedDuration;
xamlMember.SetIsReadOnly();
break;
case "BindRadioButtonsToEnums.ViewModels.JourneyViewModel1.GoByBicycleCommand":
userType = (global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlUserType)GetXamlTypeByName("BindRadioButtonsToEnums.ViewModels.JourneyViewModel1");
xamlMember = new global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlMember(this, "GoByBicycleCommand", "System.Windows.Input.ICommand");
xamlMember.Getter = get_18_JourneyViewModel1_GoByBicycleCommand;
xamlMember.SetIsReadOnly();
break;
}
return xamlMember;
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks", "4.0.0.0")]
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
internal class XamlSystemBaseType : global::Windows.UI.Xaml.Markup.IXamlType
{
string _fullName;
global::System.Type _underlyingType;
public XamlSystemBaseType(string fullName, global::System.Type underlyingType)
{
_fullName = fullName;
_underlyingType = underlyingType;
}
public string FullName { get { return _fullName; } }
public global::System.Type UnderlyingType
{
get
{
return _underlyingType;
}
}
virtual public global::Windows.UI.Xaml.Markup.IXamlType BaseType { get { throw new global::System.NotImplementedException(); } }
virtual public global::Windows.UI.Xaml.Markup.IXamlMember ContentProperty { get { throw new global::System.NotImplementedException(); } }
virtual public global::Windows.UI.Xaml.Markup.IXamlMember GetMember(string name) { throw new global::System.NotImplementedException(); }
virtual public bool IsArray { get { throw new global::System.NotImplementedException(); } }
virtual public bool IsCollection { get { throw new global::System.NotImplementedException(); } }
virtual public bool IsConstructible { get { throw new global::System.NotImplementedException(); } }
virtual public bool IsDictionary { get { throw new global::System.NotImplementedException(); } }
virtual public bool IsMarkupExtension { get { throw new global::System.NotImplementedException(); } }
virtual public bool IsBindable { get { throw new global::System.NotImplementedException(); } }
virtual public global::Windows.UI.Xaml.Markup.IXamlType ItemType { get { throw new global::System.NotImplementedException(); } }
virtual public global::Windows.UI.Xaml.Markup.IXamlType KeyType { get { throw new global::System.NotImplementedException(); } }
virtual public object ActivateInstance() { throw new global::System.NotImplementedException(); }
virtual public void AddToMap(object instance, object key, object item) { throw new global::System.NotImplementedException(); }
virtual public void AddToVector(object instance, object item) { throw new global::System.NotImplementedException(); }
virtual public void RunInitializer() { throw new global::System.NotImplementedException(); }
virtual public object CreateFromString(global::System.String input) { throw new global::System.NotImplementedException(); }
}
internal delegate object Activator();
internal delegate void AddToCollection(object instance, object item);
internal delegate void AddToDictionary(object instance, object key, object item);
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks", "4.0.0.0")]
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
internal class XamlUserType : global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlSystemBaseType
{
global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlTypeInfoProvider _provider;
global::Windows.UI.Xaml.Markup.IXamlType _baseType;
bool _isArray;
bool _isMarkupExtension;
bool _isBindable;
string _contentPropertyName;
string _itemTypeName;
string _keyTypeName;
global::System.Collections.Generic.Dictionary<string, string> _memberNames;
global::System.Collections.Generic.Dictionary<string, object> _enumValues;
public XamlUserType(global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlTypeInfoProvider provider, string fullName, global::System.Type fullType, global::Windows.UI.Xaml.Markup.IXamlType baseType)
:base(fullName, fullType)
{
_provider = provider;
_baseType = baseType;
}
// --- Interface methods ----
override public global::Windows.UI.Xaml.Markup.IXamlType BaseType { get { return _baseType; } }
override public bool IsArray { get { return _isArray; } }
override public bool IsCollection { get { return (CollectionAdd != null); } }
override public bool IsConstructible { get { return (Activator != null); } }
override public bool IsDictionary { get { return (DictionaryAdd != null); } }
override public bool IsMarkupExtension { get { return _isMarkupExtension; } }
override public bool IsBindable { get { return _isBindable; } }
override public global::Windows.UI.Xaml.Markup.IXamlMember ContentProperty
{
get { return _provider.GetMemberByLongName(_contentPropertyName); }
}
override public global::Windows.UI.Xaml.Markup.IXamlType ItemType
{
get { return _provider.GetXamlTypeByName(_itemTypeName); }
}
override public global::Windows.UI.Xaml.Markup.IXamlType KeyType
{
get { return _provider.GetXamlTypeByName(_keyTypeName); }
}
override public global::Windows.UI.Xaml.Markup.IXamlMember GetMember(string name)
{
if (_memberNames == null)
{
return null;
}
string longName;
if (_memberNames.TryGetValue(name, out longName))
{
return _provider.GetMemberByLongName(longName);
}
return null;
}
override public object ActivateInstance()
{
return Activator();
}
override public void AddToMap(object instance, object key, object item)
{
DictionaryAdd(instance, key, item);
}
override public void AddToVector(object instance, object item)
{
CollectionAdd(instance, item);
}
override public void RunInitializer()
{
System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(UnderlyingType.TypeHandle);
}
override public global::System.Object CreateFromString(global::System.String input)
{
if (_enumValues != null)
{
global::System.Int32 value = 0;
string[] valueParts = input.Split(',');
foreach (string valuePart in valueParts)
{
object partValue;
global::System.Int32 enumFieldValue = 0;
try
{
if (_enumValues.TryGetValue(valuePart.Trim(), out partValue))
{
enumFieldValue = global::System.Convert.ToInt32(partValue);
}
else
{
try
{
enumFieldValue = global::System.Convert.ToInt32(valuePart.Trim());
}
catch( global::System.FormatException )
{
foreach( string key in _enumValues.Keys )
{
if( global::System.String.Compare(valuePart.Trim(), key, global::System.StringComparison.OrdinalIgnoreCase) == 0 )
{
if( _enumValues.TryGetValue(key.Trim(), out partValue) )
{
enumFieldValue = global::System.Convert.ToInt32(partValue);
break;
}
}
}
}
}
value |= enumFieldValue;
}
catch( global::System.FormatException )
{
throw new global::System.ArgumentException(input, FullName);
}
}
return value;
}
throw new global::System.ArgumentException(input, FullName);
}
// --- End of Interface methods
public Activator Activator { get; set; }
public AddToCollection CollectionAdd { get; set; }
public AddToDictionary DictionaryAdd { get; set; }
public void SetContentPropertyName(string contentPropertyName)
{
_contentPropertyName = contentPropertyName;
}
public void SetIsArray()
{
_isArray = true;
}
public void SetIsMarkupExtension()
{
_isMarkupExtension = true;
}
public void SetIsBindable()
{
_isBindable = true;
}
public void SetItemTypeName(string itemTypeName)
{
_itemTypeName = itemTypeName;
}
public void SetKeyTypeName(string keyTypeName)
{
_keyTypeName = keyTypeName;
}
public void AddMemberName(string shortName)
{
if(_memberNames == null)
{
_memberNames = new global::System.Collections.Generic.Dictionary<string,string>();
}
_memberNames.Add(shortName, FullName + "." + shortName);
}
public void AddEnumValue(string name, object value)
{
if (_enumValues == null)
{
_enumValues = new global::System.Collections.Generic.Dictionary<string, object>();
}
_enumValues.Add(name, value);
}
}
internal delegate object Getter(object instance);
internal delegate void Setter(object instance, object value);
[System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks", "4.0.0.0")]
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
internal class XamlMember : global::Windows.UI.Xaml.Markup.IXamlMember
{
global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlTypeInfoProvider _provider;
string _name;
bool _isAttachable;
bool _isDependencyProperty;
bool _isReadOnly;
string _typeName;
string _targetTypeName;
public XamlMember(global::BindRadioButtonsToEnums.BindRadioButtonsToEnums_XamlTypeInfo.XamlTypeInfoProvider provider, string name, string typeName)
{
_name = name;
_typeName = typeName;
_provider = provider;
}
public string Name { get { return _name; } }
public global::Windows.UI.Xaml.Markup.IXamlType Type
{
get { return _provider.GetXamlTypeByName(_typeName); }
}
public void SetTargetTypeName(global::System.String targetTypeName)
{
_targetTypeName = targetTypeName;
}
public global::Windows.UI.Xaml.Markup.IXamlType TargetType
{
get { return _provider.GetXamlTypeByName(_targetTypeName); }
}
public void SetIsAttachable() { _isAttachable = true; }
public bool IsAttachable { get { return _isAttachable; } }
public void SetIsDependencyProperty() { _isDependencyProperty = true; }
public bool IsDependencyProperty { get { return _isDependencyProperty; } }
public void SetIsReadOnly() { _isReadOnly = true; }
public bool IsReadOnly { get { return _isReadOnly; } }
public Getter Getter { get; set; }
public object GetValue(object instance)
{
if (Getter != null)
return Getter(instance);
else
throw new global::System.InvalidOperationException("GetValue");
}
public Setter Setter { get; set; }
public void SetValue(object instance, object value)
{
if (Setter != null)
Setter(instance, value);
else
throw new global::System.InvalidOperationException("SetValue");
}
}
}

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

@ -0,0 +1,8 @@
Assets\Logo.png
Assets\SmallLogo.png
Assets\SplashScreen.png
Assets\StoreLogo.png
App.xaml
Common\StandardStyles.xaml
MainPage.xaml
Styles\ControlStyles.xaml

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

@ -0,0 +1,8 @@
Assets\Logo.png
Assets\SmallLogo.png
Assets\SplashScreen.png
Assets\StoreLogo.png
App.xaml
Common\StandardStyles.xaml
MainPage.xaml
Styles\ControlStyles.xaml

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

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<index root="\" startIndexAt="obj\Debug\layout.resfiles">
<default>
<qualifier name="language" value="en-US" />
</default>
<indexer-config type="RESFILES" qualifierDelimiter="." />
</index>
<index root="\" startIndexAt="obj\Debug\resources.resfiles">
<default>
<qualifier name="language" value="en-US" />
</default>
<indexer-config type="RESW" convertDotsToSlashes="true" />
<indexer-config type="RESJSON" />
<indexer-config type="RESFILES" qualifierDelimiter="." />
</index>
<index root="\" startIndexAt="obj\Debug\pri.resfiles">
<default>
<qualifier name="language" value="en-US" />
</default>
<indexer-config type="PRI" />
<indexer-config type="RESFILES" qualifierDelimiter="." />
</index>
</resources>

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

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<index root="\" startIndexAt="obj\Debug\layout.resfiles">
<default>
<qualifier name="language" value="en-US" />
</default>
<indexer-config type="RESFILES" qualifierDelimiter="." />
</index>
<index root="\" startIndexAt="obj\Debug\resources.resfiles">
<default>
<qualifier name="language" value="en-US" />
</default>
<indexer-config type="RESW" convertDotsToSlashes="true" />
<indexer-config type="RESJSON" />
<indexer-config type="RESFILES" qualifierDelimiter="." />
</index>
<index root="\" startIndexAt="obj\Debug\pri.resfiles">
<default>
<qualifier name="language" value="en-US" />
</default>
<indexer-config type="PRI" />
<indexer-config type="RESFILES" qualifierDelimiter="." />
</index>
</resources>

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 24 KiB

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

@ -0,0 +1,84 @@
# Binding RadioButtons to an Enum – Part III
This is the third of a series of posts covering different options to bind a set of RadioButtons to an enumeration. The sample code provided here is written using WinRT for Windows Store applications running on Windows 8.
In the solution discussed today, we'll use a value converter to translate between the Boolean values used by the RadioButtons and the enumeration values stored in the view model.
Our model is still the same:
public enum TransportationMode
{
Car,
Bicycle,
Train,
Boat,
Rickshaw,
Hovercraft
}
Our view model is fairly simple; we don't need the Boolean-valued properties that appeared in the previous sample, nor do we need the AvailableTransportationModes collection that appeared in the first sample.
The goal is to include each of the RadioButtons explicitly in the XAML, with its IsChecked property bound to the SelectedTransportationMode property of the view model. We'll use a value converter to help us compare the selected enum value in the view model with the enum value each RadioButton represents. If these are the same, the converter returns true, otherwise it returns false, and the RadioButton is checked or unchecked accordingly.
We started by including a generic EnumToBooleanConverter class that we reuse across many of our projects:
public class EnumToBooleanConverter<TEnum> : IValueConverter where TEnum : struct
{
public object Convert(object value, Type targetType, object parameter, string language)
{
// Convert parameter from string to enum if needed.
TEnum enumValue;
if (parameter is string &&
Enum.TryParse<TEnum>((string)parameter, true, out enumValue))
{
parameter = enumValue;
}
// Return true if value matches parameter.
return Object.Equals(value, parameter);
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
// If value is true, then return the enum value corresponding to parameter.
if (Object.Equals(value, true))
{
// Convert parameter from string to enum if needed.
TEnum enumValue;
if (parameter is string &&
Enum.TryParse<TEnum>((string)parameter, true, out enumValue))
{
parameter = enumValue;
}
return parameter;
}
// Otherwise, return UnsetValue, which is ignored by bindings.
return DependencyProperty.UnsetValue;
}
}
And then we created a strongly-typed converter that derives from this generic class:
public class TransportationModeToBooleanConverter :
EnumToBooleanConverter<TransportationMode> { }
We then added an instance of this converter to the page's resources, and data bound all RadioButtons to the same selected enumeration value in the view model. We added a converter to each of these bindings, and passed a different string in the ConverterParameter, which identifies the enumeration value each of these RadioButtons represents. Note that our generic EnumToBooleanConverter class above knows how to convert these strings into the corresponding enumeration values.
Here's what the RadioButtons look like:
<RadioButton Content="Car" GroupName="Group3"
IsChecked="{Binding
Path=SelectedTransportationMode,
Converter={StaticResource transportationModeToBooleanConverter},
ConverterParameter=Car,
Mode=TwoWay}" />
<RadioButton Content="Bicycle" GroupName="Group3"
IsChecked="{Binding
Path=SelectedTransportationMode,
Converter={StaticResource transportationModeToBooleanConverter},
ConverterParameter=Bicycle,
Mode=TwoWay}" />
...
Stay tuned for yet another solution to the same problem.
<img src="Images/BindRadioButtonsToEnums3.png" class="postImage" />