C# 在行为中使用静态资源
我有一个C# 在行为中使用静态资源,c#,wpf,C#,Wpf,我有一个文本框,并添加了一个行为: <TextBox VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Grid.Row="0" Grid.Column="1" FontSize="22" > <Binding Path="IpAddr" ValidatesOnNotifyDataErrors="True">
文本框
,并添加了一个行为:
<TextBox VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Grid.Row="0" Grid.Column="1"
FontSize="22" >
<Binding Path="IpAddr" ValidatesOnNotifyDataErrors="True">
<Binding.ValidationRules>
<local:IpAddressRule />
</Binding.ValidationRules>
</Binding>
<i:Interaction.Behaviors>
<behaviors:TextBoxInputMaskBehavior InputMask="{StaticResource InputMaskIp}" PromptChar="0" />
</i:Interaction.Behaviors>
</TextBox>
现在我的问题是,如何将资源绑定到:
<i:Interaction.Behaviors>
//Will bind resources here.
</i:Interaction.Behaviors>
//将在这里绑定资源。
交互。行为
是一个只读的行为集合
继承自AttachableCollection
&的集合,您无法对其设置绑定
<i:Interaction.Behaviors>
//Will bind resources here.
</i:Interaction.Behaviors>