使用wpf中的

时间:2022-10-03 10:48:03

I have a WPF application in which I try to rename a button like that << Précédent

我有一个WPF应用程序,我尝试重命名按钮,如< écédent

<Button Content="Suivant >>" Background="#FFF9F7F7" Margin="0,0,100,8"
        HorizontalAlignment="Right" Width="75" Height="22" VerticalAlignment="Bottom"
        RenderTransformOrigin="0.5,0" BorderBrush="CadetBlue"  BorderThickness="2" />
<Button Content="<< Précédent" Background="White" Margin="0,0,180,8"
        HorizontalAlignment="Right" Width="75" Height="22" VerticalAlignment="Bottom"
        BorderBrush="CadetBlue"  BorderThickness="2" />

But an error appears in the second button name

但第二个按钮名称中出现错误

  1. Why doesn't this work?
  2. 为什么这不起作用?

  3. How can i fix it?
  4. 我该如何解决?

1 个解决方案

#1


10  

I suspect this is just a matter of XML escaping for <, as you can't use < directly within an attribute value. Try:

我怀疑这只是XML转义的问题,因为你不能直接在属性值中使用<。尝试:

<Button Content="&lt;&lt; Précédent" ...>

... and please provide more details in your next question.

...请在下一个问题中提供更多详细信息。

(You'd need the same escaping for XML content too, as otherwise it will be treated as the start of a new element.)

(您也需要对XML内容进行相同的转义,否则它将被视为新元素的开头。)

#1


10  

I suspect this is just a matter of XML escaping for <, as you can't use < directly within an attribute value. Try:

我怀疑这只是XML转义的问题,因为你不能直接在属性值中使用<。尝试:

<Button Content="&lt;&lt; Précédent" ...>

... and please provide more details in your next question.

...请在下一个问题中提供更多详细信息。

(You'd need the same escaping for XML content too, as otherwise it will be treated as the start of a new element.)

(您也需要对XML内容进行相同的转义,否则它将被视为新元素的开头。)