&tag(XAML);
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
<Window xmlns:view="clr-namespace:Sample.View;assembly=SampleLib">
<Window.Resources>
<BooleanToVisibilityConverter x:Key="booleanToVisibilityConverter"/>
</Window.Resources>
<TextBox Visibility={Binding IsValid, Mode=OneWay,Converter={StaticResource booleanToVisibilityConverter} }"/>
XAML中で定数を定義し、幅やマージンなどに一括して指定したい場合次のようにする。
xmlns:sys="clr-namespace:System;assembly=mscorlib"
<Window.Resources>
<sys:Double x:Key="theWidth">48</sys:Double>
<Window.Resources>
<Button Width="{StaticResource theWidth}">OK</Button>