使用模板和MultiBinding的DependencyProperty.UnsetValue

时间:2017-09-27 07:46:17

标签: c# wpf xaml data-binding multibinding

当我通过模板调用我的命令时,任何人都知道我收到错误的原因:“DependencyProperty.UnsetValue” 这是我的模板:

  <DataTemplate x:Key="MenuComboBoxItemTemplate" DataType="ComboBox">
    <DockPanel>
        <TextBlock DockPanel.Dock="Left" Text="{Binding Text.Display}" />
        <Button x:Name="RemoveButton" 
                Style="{StaticResource DeleteButton}"
                DockPanel.Dock="Right"
                ToolTip="Delete"
                HorizontalAlignment="Right"
                Padding="2"
                Margin="3,0,0,0"
                Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl},AncestorLevel=1}, Path=DataContext.RemoveMenuItemCommand}">
            <Button.CommandParameter>
                <MultiBinding Converter="{StaticResource MultiValueConverter}">
                    <Binding Path="Name" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type menus:MenuComboBox}}" />
                    <Binding />
                </MultiBinding>
            </Button.CommandParameter>
            <Image Source="{dx:DXImageOffice2013 Image=Delete_16x16.png}" />
        </Button>
    </DockPanel>
</DataTemplate>

我的组合框:

<menus:MenuComboBox 
        x:Name="MyItems" 
        Grid.Column="0" 
        Grid.Row="2" 
        Padding="6,3,5,3" 
        BorderThickness="1"
        Text="{Binding MyItems, UpdateSourceTrigger=LostFocus}" 
        ItemTemplate="{StaticResource MenuComboBoxItemTemplate}"
        ItemsSource="{Binding Menus[MyItems].Items}" 
        NewMenuItemCommand="{Binding AddMenuItemCommand}"
        GotFocusCommand="{Binding GotFocusCommand}" />

我被困在上面了:(

0 个答案:

没有答案