Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 导致负值被传递到Rect.ctor的绑定_C#_Wpf_Xaml_Mvvm_Binding - Fatal编程技术网

C# 导致负值被传递到Rect.ctor的绑定

C# 导致负值被传递到Rect.ctor的绑定,c#,wpf,xaml,mvvm,binding,C#,Wpf,Xaml,Mvvm,Binding,因此,我观察到一些奇怪的行为,我无法解释自己。我有以下用户控件: <Grid Grid.Column="0" Margin="50 25 50 25"> <Grid.RowDefinitions> <RowDefinition Height="auto"/> <RowDefinition Height="*"/> <RowDefinitio

因此,我观察到一些奇怪的行为,我无法解释自己。我有以下用户控件:

        <Grid Grid.Column="0" Margin="50 25 50 25">
        <Grid.RowDefinitions>
            <RowDefinition Height="auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="auto"/>
        </Grid.RowDefinitions>

        <Label Grid.Row="0" Content="{Binding DataContext.SetcardTitle, RelativeSource={RelativeSource AncestorType={x:Type local:MainWindowEditor}}}" Style="{StaticResource editorLabelStyle}" 
               HorizontalAlignment="Center" VerticalAlignment="Center"/>

        <Border Grid.Row="1"  BorderBrush="{DynamicResource AccentBaseColorBrush}" BorderThickness="3" >
            <xctk:Zoombox x:Name="zoombox" Style="{StaticResource editorZoomboxStyle}" >
                <Canvas x:Name="myCanvas"  HorizontalAlignment="Center" VerticalAlignment="Center" ClipToBounds="True" Width="{Binding LiveImage.ViewablePicture.Width}" Height="{Binding LiveImage.ViewablePicture.Height}">
                    <Canvas.Background>
                        <ImageBrush ImageSource="{Binding LiveImage.ViewablePicture}"/>
                    </Canvas.Background>
                    <Rectangle Stroke="Cyan" StrokeThickness="3" RadiusX="100000" RadiusY="1000000"  Width="{Binding ROI.Width}" Height="{Binding ROI.Height}" Canvas.Left="{Binding ROI.X}" Canvas.Top="{Binding ROI.Y}"/>
                </Canvas>
            </xctk:Zoombox>
        </Border>

        <ListBox Grid.Row="2"  Grid.ColumnSpan="2"  MinHeight="100" Margin="0 10 0 0" ItemsSource="{Binding Images, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" ItemTemplate="{StaticResource imagesListItemStyle}">

            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel Orientation="Horizontal"/>
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
        </ListBox>
    </Grid>

这样运行应用程序会在加载usercontrol时导致以下异常(第一行显示:宽度和高度必须为非负):

为了防止这种异常,我必须完全删除标签内容的绑定

有人知道这里发生了什么吗

编辑 看起来扩展WPF工具包中的某些内容发生了变化,从而导致了这种情况。我又回到了一个旧版本,在这个版本中,一切都正常工作