实际上我想将单选按钮的内容部分绑定到工具提示的单选按钮 我是xaml的初学者,所以我需要学习它...我想学习它...更好地练习数据绑定..我的代码如下:
<Button Name="BtnDemo" Height="Auto" Width="Auto" Content="Hello Dear!" HorizontalAlignment="Left" VerticalAlignment="Top" >
<Button.ToolTip>
<ToolTip >
<StackPanel >
<TextBlock Name="txbDemo" FontWeight="SemiBold" Foreground="Brown" Text="Tool Tip Of Hello Button"/>
<TextBlock Text="This Is The Tool Tip Of Hello Button...!"/>
<RadioButton Content="{Binding Content,ElementName=BtnDemo,UpdateSourceTrigger=Default}" IsChecked="True"/>
</StackPanel>
</ToolTip>
</Button.ToolTip>
</Button>
我想在没有c#或VB.net的情况下做到这一点...... Thanx In Advance ....
答案 0 :(得分:1)
试试这个:
<Button Name="BtnDemo" Height="Auto" Width="Auto" Content="Hello Dear!" HorizontalAlignment="Left" VerticalAlignment="Top" >
<Button.ToolTip>
<ToolTip DataContext="{Binding Path=PlacementTarget, RelativeSource={RelativeSource Self}}" >
<StackPanel >
<TextBlock Name="txbDemo" FontWeight="SemiBold" Foreground="Brown" Text="Tool Tip Of Hello Button"/>
<TextBlock Text="This Is The Tool Tip Of Hello Button...!"/>
<RadioButton Content="{Binding Path=Content}" IsChecked="True"/>
</StackPanel>
</ToolTip>
</Button.ToolTip>
</Button>