coding style - Silverlight: How to change AxisLabelStyle in code behind? -


In XML files, we can change the axilabal style by doing this:

  ; ChartingToolkit: ColumnSeries.IndependentAxis & gt; & Lt; Charting Toolkit: Category Axis Orientation = "X" & gt; & Lt; ChartingToolkit: CategoryAxis.AxisLabelStyle & gt; & Lt; Style TargetType = "ChartingTulkit: Axislabel" & gt; & Lt; Setter Estates = "Template" & gt; & Lt; Setter.Value & gt; & Lt; ControlTemplate TargetType = "ChartingTulkit: Axislabel" & gt; & Lt ;! - Here are some codes - & gt; & Lt; / ControlTemplate & gt; & Lt; /Setter.Value> & Lt; / Setter & gt; & Lt; / Style & gt; & Lt; / ChartingToolkit: CategoryAxis.AxisLabelStyle & gt; & Lt; / ChartingToolkit: CategoryAxis & gt; & Lt; / ChartingToolkit: ColumnSeries.IndependentAxis & gt;   

My question is: how to add the accelerated style behind the code?

I know that we can add dotpointist by doing this:

  column series CS = new column series (); CS.DataPointStyle = Application.Current.Resources ["ByteBlocksColumns"] Style;   

But apparently we can not change the axilabal style in such a way that the axilabal style is within a range axis.

Can anyone help? Thanks!

I changed your xaml a bit.

  & lt; Charting: Chart & gt; & Lt; Charting: Colseries x: name = "cs" item source = "{binding item}" independent valuepath = "x" dependent pathway = "y" & gt; & Lt; Charting: ColumnSeries.IndependentAxis & gt; & Lt; Charting: Categoryxes Orientation = "X" /> & Lt; / Charting: ColumnSeries.IndependentAxis & gt; & Lt; / Charting: ColumnSeries & gt; & Lt; / Charting: Chart & gt;   

The above xaml can be written in c #:

  var cs = new column series {item resource = model.item, independant value = " X ", deprecated valutap =" y ", independentexes = new range axis {orientation = axisoritanation.x}};   

And now in the code-back, you can set the axilabal style property in such a way:

  var labelStyle = New Style (typeof (AxisLabel)); LabelStyle.Setters.Add (new setter (axislabel string formatting property, "category {0}")); Var axis = (class Axis) CS.IndependentAxis; Axis.AxisLabelStyle = Label style; Do not forget to put the property in the right way, because by default there is a  IXx  type that is labeled as 'label' Is the style.   

Comments