silverlight 绑定之ElementName和Path

silverlight 绑定之ElementName和Path,第1张

概述看一段代码你就知道了: <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="460" Height="200" Title="Binding the Pro

看一段代码你就知道了:

<Window  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  WIDth="460" Height="200"  Title="Binding the PropertIEs of Two Controls">  <Window.Resources>    <Style targettype="TextBlock">      <Setter Property="FontSize" Value="16"/>      <Setter Property="FontWeight" Value="Bold"/>      <Setter Property="DockPanel.Dock" Value="top"/>      <Setter Property="HorizontalAlignment" Value="Center"/>    </Style>    <Style targettype="Canvas">      <Setter Property="Height" Value="50"/>      <Setter Property="WIDth" Value="50"/>      <Setter Property="margin" Value="8"/>      <Setter Property="DockPanel.Dock" Value="top"/>    </Style>    <Style targettype="ComboBox">      <Setter Property="WIDth" Value="150"/>      <Setter Property="margin" Value="8"/>      <Setter Property="DockPanel.Dock" Value="top"/>    </Style>  </Window.Resources>  <border margin="10" borderBrush="Silver" borderThickness="3" padding="8">    <DockPanel>      <TextBlock>Choose a color:</TextBlock>      <ComboBox name="myComboBox" Selectedindex="0">        <ComboBoxItem>Green</ComboBoxItem>        <ComboBoxItem>Blue</ComboBoxItem>        <ComboBoxItem>Red</ComboBoxItem>      </ComboBox>      <Canvas>        <Canvas.Background>          <Binding Elementname="myComboBox" Path="SelectedItem.Content"/>        </Canvas.Background>      </Canvas>    </DockPanel>  </border></Window> 
运行效果:

总结

以上是内存溢出为你收集整理的silverlight 绑定之ElementName和Path全部内容,希望文章能够帮你解决silverlight 绑定之ElementName和Path所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/web/1078056.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-27
下一篇2022-05-27

发表评论

登录后才能评论

评论列表(0条)

    保存