wpf xaml 中的计算绑定不用convert
Key features and restrictions:
- One or many source properties in Path with many available operators: description
<Label Content="{c:Binding A*0.5+(B.NestedProp1/C - B.NestedProp2 % C) }" />
<c:Binding 'A and B or C' />
- One or many static properties in Path: description
<TextBox Text="{c:Binding 'local:StaticClass.Prop1 + local:OtherStaticClass.NestedProp.PropB + PropC'}"/>
<Button Background="{c:Binding '(A > B ? media:Brushes.LightBlue : media:Brushes.White)'}"/>
- Properties and methods of class System.Math in Path: description
<TextBox Text="{c:Binding 'Math.Sin(Math.Cos(A))'}"/>
- Enum types like constants or source properties in Path: description
<TextBox Text="{c:Binding '(EnumValue == local:CustomEnum.Value1 ? 10 : 20)'}"/>
- Automatic inversion of binding expression if it's possible: description
<TextBox Text = "{c:Binding 'Math.Sin(A*2)-5'}"/> {two way binding will be created}
- Automatic two way convertion of bool expression to Visibility and back if target property has such type: description
<Button Visibility="{c:Binding !IsChecked}" />
<Button Visibility="{c:Binding IsChecked, FalseToVisibility=Hidden}" />
-
Other features such as string and char constants support and other: description
-
General restrictions: description
快速使用:PM> Install-Package CalcBinding
xmlns:c="clr-namespace:CalcBinding;assembly=CalcBinding"
<Label IsEnabled="{c:Binding Path=!fullFill}" />
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
2018-06-22 WebView 判断放大缩小操作
2016-06-22 javascript 键盘输入过滤,只能输入数字,小数一位且只能输入5