形如下,将converter的类库引用进来
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:Custom="http://schemas.devexpress.com/winfx/2008/xaml/editors/internal"
xmlns:local="clr-namespace:HLZD.SMS.UI.WPF.Resources.Controls"
xmlns:converter="clr-namespace:HLZD.SMS.UI.WPF.Projects.GrapDispatching"
xmlns:dxlc="http://schemas.devexpress.com/winfx/2008/xaml/layoutcontrol">
<Style TargetType="dxlc:LayoutItem" x:Key="addnewPlan">
<Setter Property="AddColonToLabel" Value="True"/>
<Setter Property="LabelHorizontalAlignment" Value="Right"/>
<Setter Property="LabelTemplate">
<Setter.Value>
<DataTemplate>
<TextBlock Width="96" Height="16" TextAlignment="Right">
<TextBlock.Style>
<Style>
<Setter Property="TextBlock.Text">
<Setter.Value>
<Binding>
<Binding.Converter>
<converter:ReplaceChar />
</Binding.Converter>
</Binding>
</Setter.Value>
</Setter>
</Style>
</TextBlock.Style>
</TextBlock>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
最主要是这句
<TextBlock Width="96" Height="16" TextAlignment="Right">
<TextBlock.Style>
<Style>
<Setter Property="TextBlock.Text">
<Setter.Value>
<Binding>
<Binding.Converter>
<converter:ReplaceChar />
</Binding.Converter>
</Binding>
</Setter.Value>
</Setter>
</Style>
</TextBlock.Style>
</TextBlock>
https://stackoverflow.com/questions/6971714/how-to-use-a-converter-inside-a-resourcedictionary