Wpf公共属性为ConvertParameter

时间:2018-05-29 08:27:57

标签: wpf

ConvertParameter as public propoerty

我会在我的转换器" FormatValues"中添加一个参数。这是XAML代码:

<ItemsControl ItemsSource="{Binding Data.Points}" Grid.IsSharedSizeScope="True">
    <ItemsControl.ItemTemplate>
        <DataTemplate DataType="{x:Type wpf:DataPointViewModel}">
            <Grid Margin="2">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" SharedSizeGroup="Title"/>
                    <ColumnDefinition Width="Auto" SharedSizeGroup="Value"/>
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Column="0" Text="{Binding Series.Title}" Margin="2,1" />
                <TextBlock Grid.Column="1" Text="{Binding ChartPoint.Y, Converter={StaticResource FormatValues}}" Margin="2,0" FontFamily="{StaticResource fntRoboto}" />
            </Grid>
        </DataTemplate>
    </ItemsControl.ItemTemplate>
</ItemsControl>

我的代码背后:

public partial class ViewerStatisticsTT : IChartTooltip
    {
        public bool Antani { get; set; }

        public ViewerStatisticsTT()
        {
            InitializeComponent();
            DataContext = this;            
        }
    }   

我班上另一个班的就是:

<userControls:ViewerStatisticsTT Antani="True" />

基本上我想要的是&#34; Antani&#34;参数并将其用作ConvertParameter。任何提示?

0 个答案:

没有答案