gpt4 book ai didi

c# - 如何将带空格的字符串传递给 converterParameter?

转载 作者:IT王子 更新时间:2023-10-29 04:33:53 25 4
gpt4 key购买 nike

我的示例代码如下。

我想将“Go to linked item”传递给 ConverterParameter 但我不能,因为字符串中有空格。

Text="{Binding Value, 
Source={x:Static local:Dictionary.Instance},
Converter={StaticResource StringConverter},
ConverterParameter=Go to linked item, Mode=OneWay}"

我该怎么做?

最佳答案

选项 1

Text="{Binding Value, 
Source={x:Static local:Dictionary.Instance},
Converter={StaticResource StringConverter},
ConverterParameter='Go to linked item', Mode=OneWay}"

选项 2

如果你想在多个地方使用它,添加一个字符串资源。

<sys:String x:Key="GoToLink">Go to linked item</sys:String>

并传递资源 key 。

ConverterParameter={StaticResource ResourceKey=GoToLink}}

关于c# - 如何将带空格的字符串传递给 converterParameter?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32471013/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com