gpt4 book ai didi

windows-phone-7 - 在 WP7 中将 Text 属性与 ApplicationBarIconButton 绑定(bind)

转载 作者:行者123 更新时间:2023-12-04 14:04:10 24 4
gpt4 key购买 nike

我想将字符串绑定(bind)到 WP7 中 ApplicationBarIconButton 中的文本属性。
这样做时,我收到一个错误

设置属性“Microsoft.Phone.Shell.ApplicationBarIconButton.Text”引发异常。

堆栈跟踪:

at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, StackCrawlMark& stackMark) at System.Reflection.RuntimePropertyInfo.InternalSetValue(PropertyInfo thisProperty, Object obj, Object value, Object[] index, StackCrawlMark& stackMark) at System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, Object[] index) at MS.Internal.XamlMemberInfo.SetValue(Object target, Object value) at MS.Internal.XamlManagedRuntimeRPInvokes.SetValue(XamlTypeToken inType, XamlQualifiedObject& inObj, XamlPropertyToken inProperty, XamlQualifiedObject& inValue) at MS.Internal.XcpImports.Application_LoadComponentNative(IntPtr pContext, IntPtr pComponent, UInt32 cUriStringLength, String uriString, UInt32 cXamlStrLength, Byte* pXamlStr, UInt32 cAssemblyStrLength, String assemblyStr) at MS.Internal.XcpImports.Application_LoadComponent(IManagedPeerBase componentAsDO, String resourceLocator, UnmanagedMemoryStream stream, UInt32 numBytesToRead, String assemblyString) at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator) at Syncfusion.Phone.Tools.Controls.TimeSpanPickerPage.InitializeComponent() at Syncfusion.Phone.Tools.Controls.TimeSpanPickerPage..ctor() at System.Reflection.RuntimeConstructorInfo.InternalInvoke(RuntimeConstructorInfo rtci, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess, StackCrawlMark& stackMark) at System.Reflection.RuntimeConstructorInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, StackCrawlMark& stackMark) at System.Activator.InternalCreateInstance(Type type, Boolean nonPublic, StackCrawlMark& stackMark) at System.Activator.CreateInstance(Type type) at System.Windows.Navigation.PageResourceContentLoader.BeginLoad_OnUIThread(AsyncCallback userCallback, PageResourceContentLoaderAsyncResult result) at System.Windows.Navigation.PageResourceContentLoader.<>c_DisplayClass4.b_0(Object args) at System.Reflection.RuntimeMethodInfo.InternalInvoke(RuntimeMethodInfo rtmi, Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess, StackCrawlMark& stackMark) at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, StackCrawlMark& stackMark) at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) at System.Delegate.DynamicInvokeOne(Object[] args) at System.MulticastDelegate.DynamicInvokeImpl(Object[] args) at System.Delegate.DynamicInvoke(Object[] args) at System.Windows.Threading.DispatcherOperation.Invoke() at System.Windows.Threading.Dispatcher.Dispatch(DispatcherPriority priority) at System.Windows.Threading.Dispatcher.OnInvoke(Object context) at System.Windows.Hosting.CallbackCookie.Invoke(Object[] args) at System.Windows.Hosting.DelegateWrapper.InternalInvoke(Object[] args) at System.Windows.RuntimeHost.ManagedHost.InvokeDelegate(IntPtr pHandle, Int32 nParamCount, ScriptParam[] pParams, ScriptParam& pResult)



解决方案: ApplicationBar 是未在 Silverlight 中实现的特殊元素,不能与数据绑定(bind)一起使用。您必须直接更新 C# 中的 Text 属性。 Peter Torr 在这里解释它:Peter Torr 的博客 > Why are the ApplicationBar objects not FrameworkElements?

最佳答案

在我看来你已经知道答案了,无论如何绑定(bind)数据 ApplicationBar 是不可能的,你可以在运行时创建应用程序栏,你也许可以从那里做一些事情。 ApplicationBarIconButton At Runtime

关于windows-phone-7 - 在 WP7 中将 Text 属性与 ApplicationBarIconButton 绑定(bind),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9920840/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com