wpf中:xaml中的命名空间的引入
本文章已收录于:
- 在xaml中如有要使用c#数据类型,那么需要引入c#的命名空间,如需要使用String类,则需要引入String所在的命名空间。
[html]
view plain
copy
print
?
- <Window x:Class="Test2.MainWindow"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:sys="clr-namespace:System;assembly=mscorlib"
- Title="MainWindow" Height="350" Width="525">
- <Grid>
-
- <StackPanel>
- <StackPanel.Resources>
- <sys:String x:Key="myString">
- lasklsdsldfslfd
- </sys:String>
- </StackPanel.Resources>
- <TextBox x:Name="textBox1" Text="{Binding Path=Text[4],ElementName=textBox2, Mode=OneWay}"></TextBox>
- <TextBox x:Name="textBox2" Text="{StaticResource ResourceKey=myString}"></TextBox>
- </StackPanel>
- </Grid>
- </Window>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)