这是我想要做的。
切换按钮 1 (editNameOpen)
- 选中后,显示弹出内容
- 关闭它的唯一方法是从弹出窗口内的另一个切换按钮(editNameClose)
切换按钮 2 (editNameClose)
- 这个在弹出窗口里面
- 当 IsChecked 时,关闭弹出窗口并关闭 editNameOpen
这是我用来尝试解决问题的一些 xaml。到目前为止的问题/问题:
- 我的 MultiBinding 错误并引发运行时错误“无法设置 MultiBinding,因为必须指定 MultiValueConverter。” 在这种情况下 MultiValueConverter 会转换什么?
- 当第二个被选中时,我将如何关闭第一个切换按钮?
干杯,
贝里尔
<ToggleButton x:Name="editNameOpen" Style="{StaticResource EditToggleButtonStyle}" Grid.Column="1" Grid.Row="0"/>
<Popup x:Name="popupNameEditingControl"
PlacementTarget="{Binding ElementName=editeditNameOpenName}"
PopupAnimation="Slide"
StaysOpen="False" ** shoulf this be true?
MinWidth="50">
** open and stay open while until editNameClose is checked
<Popup.IsOpen>
<MultiBinding >
<Binding Mode="OneWay" ElementName="editNameOpen" Path="IsChecked"/>
<Binding Mode="OneWay" ElementName="editNameClose" Path="IsChecked" Converter="{StaticResource invertBoolConv}"/>
</MultiBinding>
</Popup.IsOpen>
** how do we reset editNameOpen to be NOT IsChecked when editNameClose is checked?
** how do we reset editNameClose to be NOT IsChecked and then reset editNameClose to also be not checked when this opens again?
<StackPanel Orientation="Horizontal" Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}">
<Label Content="Hello Wolrd!"/>
<ToggleButton x:Name="editNameClose" Content="X"/>
</StackPanel>
</Popup>