Skip to content

Commit

Permalink
ver2
Browse files Browse the repository at this point in the history
  • Loading branch information
mate1213 committed Apr 26, 2018
1 parent 52288b7 commit 70b8684
Show file tree
Hide file tree
Showing 43 changed files with 9,180 additions and 112 deletions.
691 changes: 691 additions & 0 deletions ColorPickerCustomControl/ColorPickerLib/ColorPicker.cs

Large diffs are not rendered by default.

69 changes: 69 additions & 0 deletions ColorPickerCustomControl/ColorPickerLib/ColorPicker.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="15.0">
<!-- MSBUILD Project File -->
<PropertyGroup>
<DefaultClrNameSpace>Microsoft.Samples.ColorPickerExample</DefaultClrNameSpace>
<AssemblyName>ColorPicker</AssemblyName>
<TargetType>library</TargetType>
<Configuration>Release</Configuration>
<BuildSystem>MSBuild</BuildSystem>
<HostInBrowser>False</HostInBrowser>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{99E90579-62FC-4898-B168-24F7DBD3A34D}</ProjectGuid>
<OutputPath>bin\$(Configuration)\</OutputPath>
<RootNamespace>Microsoft.Samples.CustomControls</RootNamespace>
<StartupObject>
</StartupObject>
<OutputType>Library</OutputType>
<TargetFrameworkVersion>v3.0</TargetFrameworkVersion>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>2.0</OldToolsVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DocumentationFile>
</DocumentationFile>
<CodeAnalysisRules>
</CodeAnalysisRules>
</PropertyGroup>
<!--Import the target file that contains all the common targets -->
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<!-- Aplication Definition Markup File -->
<Page Include="ColorPickerDialog.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Themes\generic.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<ItemGroup>
<Compile Include="ColorPicker.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="SupportingClasses.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="ColorPickerDialog.xaml.cs">
<DependentUpon>ColorPickerDialog.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Drawing" />
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="UIAutomationProvider" />
<Reference Include="UIAutomationTypes" />
</ItemGroup>
</Project>
27 changes: 27 additions & 0 deletions ColorPickerCustomControl/ColorPickerLib/ColorPickerDialog.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="Microsoft.Samples.CustomControls.ColorPickerDialog"
xmlns:customControls="clr-namespace:Microsoft.Samples.CustomControls"
Title="Select a Color"
Width="600"
Height="400">
<DockPanel>
<StackPanel DockPanel.Dock="Bottom"
Orientation="Horizontal"
HorizontalAlignment="Right"
Margin="10">
<Button Name="OKButton"
Click="okButtonClicked"
IsEnabled="False">OK</Button>
<Button Click="cancelButtonClicked">Cancel</Button>
</StackPanel>

<customControls:ColorPicker
x:Name="cPicker"
SelectedColorChanged="onSelectedColorChanged"
Margin="10,10,10,0"/>
</DockPanel>


</Window>
93 changes: 93 additions & 0 deletions ColorPickerCustomControl/ColorPickerLib/ColorPickerDialog.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Media.Animation;

namespace Microsoft.Samples.CustomControls
{
/// <summary>
/// Interaction logic for ColorPickerDialog.xaml
/// </summary>

public partial class ColorPickerDialog : Window
{


public ColorPickerDialog()
{
InitializeComponent();
}

private void okButtonClicked(object sender, RoutedEventArgs e)
{

OKButton.IsEnabled = false;
m_color = cPicker.SelectedColor;
DialogResult = true;
Hide();

}


private void cancelButtonClicked(object sender, RoutedEventArgs e)
{

OKButton.IsEnabled = false;
DialogResult = false;

}

private void onSelectedColorChanged(object sender, RoutedPropertyChangedEventArgs<Color> e)
{

if (e.NewValue != m_color)
{

OKButton.IsEnabled = true;
}
}

protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{

OKButton.IsEnabled = false;
base.OnClosing(e);
}


private Color m_color = new Color();
private Color startingColor = new Color();

public Color SelectedColor
{
get
{
return m_color;
}

}

public Color StartingColor
{
get
{
return startingColor;
}
set
{
cPicker.SelectedColor = value;
OKButton.IsEnabled = false;

}

}


}
}
39 changes: 39 additions & 0 deletions ColorPickerCustomControl/ColorPickerLib/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
//<snippet2>
//used to let loading assemblies know that theme resources are stored in this assembly
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
//</snippet2>
// 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("ColorPickerDialog")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("ColorPickerDialog")]
[assembly: AssemblyCopyright("Copyright © MSFT 2006")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM componenets. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("99E90579-62FC-4898-B168-24F7DBD3A34D")]

// 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 Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Loading

0 comments on commit 70b8684

Please sign in to comment.