WP8将几何体项传递给代码隐藏以添加到路径。数据类型导致XamlParseException
我在尝试将WP8将几何体项传递给代码隐藏以添加到路径。数据类型导致XamlParseException,xaml,windows-phone-8,Xaml,Windows Phone 8,我在尝试将几何体项传递给用户控件元素的代码隐藏时遇到问题。当我尝试将路径元素数据属性设置到此几何体项时,会得到一个XamlParseexception 下面是我的代码的一部分在代码背后 void CardBack_Loaded(object sender, RoutedEventArgs e) { Header.Text = _title; Text_run.Text = _title; Image.Data = setGeomet
几何体
项传递给用户控件
元素的代码隐藏时遇到问题。当我尝试将路径
元素数据属性设置到此几何体
项时,会得到一个XamlParseexception
下面是我的代码的一部分在代码背后
void CardBack_Loaded(object sender, RoutedEventArgs e)
{
Header.Text = _title;
Text_run.Text = _title;
Image.Data = setGeometry(AppResources.SECURITY_IMAGE_DATA); //this is where i am having the issue
Cdescrption.Text = _description;
}
Image
引用我在此处创建的路径,即path元素的xaml
<Path x:Name="Image" Margin="30,20,30,10" VerticalAlignment="Center" Grid.Row="1"/>
至少我知道如果我这样做,我肯定有正确的对象类型
仍然坚持这个!当我只想把数据添加到一个路径上时,这真是太可怕了你试过了吗:-
var geometry = Application.Current.Resources["SECURITY_IMAGE_DATA"]; // SECURITY_IMAGE_DATA should be a string or string type object, that have a resource name.
Image.Data = setGeometry(geometry);
我将安全图像数据存储为字符串。这对Mei不起作用,如果它是一个字符串,那么…[“SECURITY\u IMAGE\u DATA”],然后将其强制转换为您想要的类型。你能分享一下setGeometry的代码吗?我们会提供setGeometry,但这完全是一个黑客行为。我对它不满意,但我需要完成这件事。你只能把方法和它的签名。非常感谢你的帮助。谢谢你抽出时间来帮助我!
var geometry = Application.Current.Resources["SECURITY_IMAGE_DATA"]; // SECURITY_IMAGE_DATA should be a string or string type object, that have a resource name.
Image.Data = setGeometry(geometry);