我有一些像这样的xaml代码:
Server Error in '/home' Application.
Format of the initialization string does not conform to specification starting at index 0.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0.
Source Error:
Line 77: // This doesn't count login failures towards account lockout
Line 78: // To enable password failures to trigger account lockout, change to shouldLockout: true
Line 79: var result = await SignInManager.PasswordSignInAsync(model.Email, model.Password, model.RememberMe, shouldLockout: false);
Line 80: switch (result)
Line 81: {
Source File: D:\Release 1 \Zip\ClassRoom\ClassRoom\Controllers\AccountController.cs Line: 79
Stack Trace:
[ArgumentException: Format of the initialization string does not conform to specification starting at index 0.]
System.Data.Common.DbConnectionOptions.GetKeyValuePair(String connectionString, Int32 currentPosition, StringBuilder buffer, Boolean useOdbcRules, String& keyname, String& keyvalue) +1985
System.Data.Common.DbConnectionOptions.ParseInternal(Hashtable parsetable, String connectionString, Boolean buildChain, Hashtable synonyms, Boolean firstKey) +197
x轴的样式取决于属性。转换器选择在xaml中某处定义的三种不同静态资源中的一种。 现在轴本身也是多态的,所以我在后面的代码中创建它:
<s:SciChartSurface>
<s:SciChartSurface.XAxis>
<s:NumericAxis Style="{Binding ..., Converter=...}" />
</s:SciChartSurface.XAxis>
</s:SciChartSurface>
或
<s:SciChartSurface>
<s:SciChartSurface.XAxis>
<Binding CreateAxis />
</s:SciChartSurface.XAxis>
</s:SciChartSurface>
但是如何将动态样式应用于后面代码中创建的对象?
答案 0 :(得分:0)
您的问题有点不清楚,因为您根本没有发布任何代码隐藏代码,但我相信您希望能够做到这样的事情:
var axis = new SciChart.Charting.Visuals.Axes.NumericAxis();
axis.SetBinding(SciChart.Charting.Visuals.Axes.NumericAxis.StyleProperty, new System.Windows.Data.Binding("Path") { Converter = new YourConverterClass });
ss.XAxis = axis;
在您的XAML标记中为SciChartSurface
元素添加x:Name
,然后将其XAxis
属性设置为您以编程方式创建的NumericAxis
对象:
<s:SciChartSurface x:Name="ss">