Hello,
je reprends un exemple WPF, la partie de l'exemple qui m'intéresse est en XAML, je souhaite réaliser la même opération en code-behind.
<sync:ChartSeries Name="series12" Type="FastStackingColumn" FastSegmentProperties="{Binding Converter={StaticResource interiorConverter} }" Stroke="Black" DataSource="{Binding}"/>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
public class ChartSeries : FrameworkContentElement,
IDisposable
{
public static readonly DependencyProperty FastSegmentPropertiesProperty;
public FastSegmnetPropertiesCollection FastSegmentProperties
{
get
{
return (FastSegmnetPropertiesCollection) base.GetValue(FastSegmentPropertiesProperty);
}
set
{
base.SetValue(FastSegmentPropertiesProperty, value);
}
}
}
.....
public class FastSegmnetProperties : DependencyObject
{
}
.....
public class FastSegmnetPropertiesCollection : ObservableCollection<FastSegmnetProperties>
{
...
} |
Mon code -- Création de la série
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
ChartSeries serie = null;
if (infos.Count > 200)
serie = new ChartSeries(ChartTypes.FastLine);
else
serie = new ChartSeries(ChartTypes.Line);
Binding bind1 = new Binding();
bind1.Converter = convert1;
bind1.Source = ChartSeries.FastSegmentPropertiesProperty;
Binding bind2 = new Binding();
bind2.Source = serie.DataSource;
serie.SetBinding(ChartSeries.FastSegmentPropertiesProperty, bind1);
serie.SetBinding(ChartSeries.DataSourceProperty, bind2);
serie.DataSource = backupModel; |
Mon code -- Ajout de données
1 2
|
backupModel.Add(new Valeur(vi)); |
je passe bien dans le Coverter lors de la construction du serie qui affecte le DataSource, mais quand je modifie la collection affectée au datasource, je ne passe pas dans le converter, merci de m'indiquer le pourquoi.
Partager