WPF-如何将样式的设置器绑定到元素的属性?

时间:2019-08-14 11:39:06

标签: c# wpf xaml

在WPF,XAML中,我有一种样式已应用于ComboBox的项目,我想获取当前项目的Content属性,但这似乎不起作用:

<dxe:ComboBoxEdit.Items>
    <Style TargetType="{x:Type dxe:ComboBoxEditItem}">
        <Style.Setters>
            <Setter Property="Content" Value="{Binding Converter={StaticResource CrsNameCvtor}, ConverterParameter={Binding Content,RelativeSource={RelativeSource Self}}}"/>
        </Style.Setters>
    </Style>
</dxe:ComboBoxEdit.Items>

1 个答案:

答案 0 :(得分:1)

应将样式分配给ComboBox的fmap read getLine属性,并且根本不需要设置绑定的ConverterParameter:

main :: IO [Int]
main = do
  let size = 3
  replicateM size readLn