2
A
回答
1
你可以嘗試自定義顏色選擇器 - 這裏的an article on Nokia Developer Wiki由司帕索拉扎雷維奇寫的。
歸結爲在不同的頁面上使用預定義的一組顏色,很好地佈局。
3
我的解決辦法是讓Colorsource文件夾下的ColorPicker類(或任何你想將它命名),它包含顏色數據
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MyApps.Colorsource
{
class ColorPicker
{
public static List<ColorPicker> ColorData()
{
string[] colorNames =
{
"White","Black","Yellow","BananaYellow","LaserLemon","Jasmine","Green","Emerald",
"GreenYellow","Lime","Chartreuse","LimeGreen","SpringGreen","LightGreen",
"MediumSeaGreen","MediumSpringGreen","Olive","SeaGreen","Red","OrangeRed",
"DarkOrange","Orange","ImperialRed","Maroon","Brown","Chocolate",
"Coral","Crimson","DarkSalmon","DeepPink","Firebrick","HotPink",
"IndianRed","LightCoral","LightPink","LightSalmon","Magenta","MediumVioletRed",
"Orchid","PaleVioletRed","Salmon","SandyBrown","Navy","Indigo",
"MidnightBlue","Blue","Purple","BlueViolet","CornflowerBlue","Cyan",
"DarkCyan","DarkSlateBlue","DeepSkyBlue","DodgerBlue","LightBlue","LightSeaGreen",
"LightSkyBlue","LightSteelBlue","Mauve","MediumSlateBlue","RoyalBlue","SlateBlue",
"SlateGray","SteelBlue","Teal","Turquoise","DarkGrey","LightGray"
};
string[] uintColors =
{
"#FFFFFFFF","#FF000000","#FFFFFF00","#FFFFE135","#FFFFFF66","#FFF8DE7E", "#FF008000",#FF008A00","#FFADFF2F","#FF00FF00","#FF7FFF00","#FF32CD32",
"#FF00FF7F","#FF90EE90",
"#FF3CB371","#FF00FA9A","#FF808000","#FF2E8B57","#FFFF0000","#FFFF4500",
"#FFFF8C00","#FFFFA500","#FFED2939","#FF800000","#FFA52A2A","#FFD2691E",
"#FFFF7F50","#FFDC143C","#FFE9967A","#FFFF1493","#FFB22222","#FFFF69B4",
"#FFCD5C5C","#FFF08080","#FFFFB6C1","#FFFFA07A","#FFFF00FF","#FFC71585",
"#FFDA70D6","#FFDB7093","#FFFA8072","#FFF4A460","#FF000080","#FF4B0082",
"#FF191970","#FF0000FF","#FF800080","#FF8A2BE2","#FF6495ED","#FF00FFFF",
"#FF008B8B","#FF483D8B","#FF00BFFF","#FF1E90FF","#FFADD8E6","#FF20B2AA",
"#FF87CEFA","#FFB0C4DE","#FF76608A","#FF7B68EE","#FF4169E1","#FF6A5ACD",
"#FF708090","#FF4682B4","#FF008080","#FF40E0D0","#FFA9A9A9","#FFD3D3D3"
};
// i variable depends on how many color you want to add in my case i have 67 colors
var data = new List<ColorPicker>();
for (int i = 0; i < 68; i++) {
data.Add(new ColorPicker(colorNames[i], uintColors[i]));
}
return data;
}
public ColorPicker(string name, string color)
{
Name = name;
Coloruint = color;
}
public string Name { get; set; }
public string Coloruint { get; set; }
}
}
然後列表中創建一個GridView
<GridView x:Name="ColorGrid"
ItemsSource="{Binding}"
VerticalAlignment="Top"
Tapped="ColorGrid_Tapped">
<GridView.ItemTemplate>
<DataTemplate>
<Grid>
<Ellipse Fill="{Binding Coloruint}"
Height="50"
Width="50"
Margin="10"/>
</Grid>
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
的OnNavigatedTo在該頁面添加此代碼
var colorViewModel=ColorPicker.ColorData();
ColorGrid.DataContext = colorViewModel;
要使用gridviewta上的顏色數據pped添加以下代碼
private void ColorGrid_Tapped(object sender, TappedRoutedEventArgs e)
{
Ellipse senderObject = e.OriginalSource as Ellipse;
if (senderObject != null)
{
//senderObject.Fill;<< This is content color data
}
}
希望這有助於:d 我有這個想法從 http://spasol.wordpress.com/2013/06/02/custom-color-picker-for-windows-phone/
相關問題
- 1. c#的Windows Phone 8.1更改默認控件顏色
- 2. C#/ XAML - Windows Phone 8.1 - 鍵盤顏色
- 3. Windows Phone 8.1/Windows phone 8.1銀色燈的自動撥號器
- 4. windows phone 8.1瓷磚顏色爲特定顏色
- 5. 在Windows Phone 7中是否有工作顏色選擇器控件?
- 6. C#Windows Phone 8.1語言選擇
- 7. Windows Phone 8.1文件打開選擇器頁面導航錯誤
- 8. Windows Store App Winjs是否具有顏色選擇器控件?
- 9. WP7顏色選擇器
- 10. Windows Phone 8.1嚮導控制
- 11. 顏色選擇器,每個顏色選擇發送事件
- 12. 顏色選擇器
- 13. Windows Phone 8.1(WinRT):自定義循環選擇器
- 14. Windows Phone 8.1 PDF查看器
- 15. TabBar控制器選擇顏色
- 16. Windows Phone的8.1
- 17. Windows Phone 8.1 IRC
- 18. Windows Phone 8.1 WebAuthenticationBrokerContinuationEventArgs
- 19. Windows Phone 8.1 UNHANDLED_EXCEPTION
- 20. MediaElement Windows Phone 8.1
- 21. 如何更改頁面的背景顏色,Windows Phone 8.1 C#XAML
- 22. 如何動態設置Windows Phone 8.1按鈕的顏色屬性
- 23. 如何更改Windows Phone 8.1 XAML ToolKit圖表中LineSeries的顏色?
- 24. C#Windows Phone 8.1創建文件容器
- 25. 製作文件選擇異步 - 的Windows Phone 8.1
- 26. Windows Phone芒果選擇器
- 27. Windows Phone 8.1上的WebRtc 8.1
- 28. Android的ListView控件選擇顏色
- 29. 按鈕顏色-Windows Phone 7
- 30. 如何選擇的Windows Phone 8.1下拉所選項目