[UWP]尝试在uwp中实现颜色选择器 [英] [UWP]Trying to implement color picker in uwp
问题描述
我正在尝试使用以下链接在uwp中实现颜色选择器
http://www.c-sharpcorner.com/article/coding4fun-colorpicker-control-in-uwp-with-xaml-and-c-sharp/
但是在关注过程和实施'colorchange'ev它正在给出错误"无法添加事件处理程序"。
其他活动正在运作。只有'colorchange'事件无效
任何想法都会受到赞赏。
XAML
在页面顶部
xmlns:my =" using Coding4Fun.Toolkit.Controls"
Xaml Part
< my:ColorPicker x:Name =" W_Paints"
Margin =" 216,203,-6,0" Height =" 40"
Width =" 40" ; VerticalAlignment =" Top"
HorizontalAlignment =" Left" />
你好pariwesh,
我安装了Coding4Fun Toolkit - Controls,在
软件包管理器控制台
PM> Install-Package Coding4Fun.Toolkit.Controls
我在我的UWP项目中使用了这个控件,并且ColorChanged事件运行良好。以下是我的主要代码和项目的属性。
< Page
x:Class =" AppC4F.MainPage"
xmlns =" http://schemas.microsoft.com/winfx/2006/xaml/presentation" ;
xmlns:x =" http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local =" using:AppC4F"
xmlns:d =" ; http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc =" http:// schemas .openxmlformats.org /标记兼容性/ 2006"
xmlns:c4fcontrols =" using:Coding4Fun.Toolkit.Controls"
mc:Ignorable =" d">
< Grid Background =" {ThemeResource ApplicationPageBackgroundThemeBrush}">
< c4fcontrols:ColorPicker ColorChanged =" ColorPicker_ColorChanged"高度= QUOT; 100"宽度= QUOT; 100">< / c4fcontrols:颜色拾取>
< / Grid>
< / Page>
private void ColorPicker_ColorChanged(object sender,Windows.UI.Color color)
{
Debug.WriteLine(color.ToString());
}
// project.json
{
" dependencies":{
" Coding4Fun.Toolkit.Controls":" 2.1.8",
" Microsoft.NETCore.UniversalWindowsPlatform":" 5.1.0"
},
" frameworks" ;: {
" uap10.0":{}
},
" runtimes":{
" ; win10-arm":{},
" win10-arm-aot":{},
" win10-x86":{},
" win10-x86-aot" ;:{},
" win10-x64":{},
" win10-x64-aot":{}
}
}您可以尝试使用该命令来安装此工具包。
最好的问候,
Xavier Eoro
I'm trying to implement color picker in uwp using below link
http://www.c-sharpcorner.com/article/coding4fun-colorpicker-control-in-uwp-with-xaml-and-c-sharp/
but while following process and implementing 'colorchange' event it is giving error "unable to add event handler".
other events are working .only 'colorchange' event is not working
Any idea would be appreciated .
XAML
At the top of page
xmlns:my="using:Coding4Fun.Toolkit.Controls"
Xaml Part
<my:ColorPicker x:Name="W_Paints" Margin="216,203,-6,0" Height="40" Width="40" VerticalAlignment="Top" HorizontalAlignment="Left"/>
Hello pariwesh,
I installed Coding4Fun Toolkit - Controls, run the following command in the Package Manager Console
PM> Install-Package Coding4Fun.Toolkit.Controls
I used this control in my UWP project and the ColorChanged event worked well. The following is my main code and project’s property.
<Page x:Class="AppC4F.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:AppC4F" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:c4fcontrols="using:Coding4Fun.Toolkit.Controls" mc:Ignorable="d"> <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <c4fcontrols:ColorPicker ColorChanged="ColorPicker_ColorChanged" Height="100" Width="100"></c4fcontrols:ColorPicker> </Grid> </Page>
private void ColorPicker_ColorChanged(object sender, Windows.UI.Color color) { Debug.WriteLine(color.ToString()); }//project.json { "dependencies": { "Coding4Fun.Toolkit.Controls": "2.1.8", "Microsoft.NETCore.UniversalWindowsPlatform": "5.1.0" }, "frameworks": { "uap10.0": {} }, "runtimes": { "win10-arm": {}, "win10-arm-aot": {}, "win10-x86": {}, "win10-x86-aot": {}, "win10-x64": {}, "win10-x64-aot": {} } }You could try to use the command to install this toolkit.
Best Regards,
Xavier Eoro
这篇关于[UWP]尝试在uwp中实现颜色选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!