0

我的应用程序在某些计算机上的行为很奇怪(它只发生在某些客户电脑上,我无法在我的机器上重现它)。

我有一个应用程序可以输入和查看生产报废数据。每列都是它自己的控件。扩展器是 WPF 工具包中的手风琴控件。

有时文本块不可见:

在此处输入图像描述

当错误发生在文本框上时,它们甚至不会占用任何空间:

在此处输入图像描述

这是 Accordion 项目内容的数据模板:

        <DataTemplate x:Key="YieldAccContent" DataType="Models:Cell">
            <DataTemplate.Resources>
                <DataTemplate x:Key="It1"> 
                    <StackPanel >
                        <Label BorderBrush="{x:Static SystemColors.ControlLightBrush}" Padding="1" Height="22" BorderThickness="1" Content="{Binding Value}" Visibility="{Binding Cell.CellGroup.ParentMeasurement.IsEnabled, Converter ={StaticResource boolTovisinv}}"/>
                        <controls:NumberTextbox Text="{Binding Value,  Converter ={StaticResource EmptyStringToNullConverter}, UpdateSourceTrigger=PropertyChanged}" Height="22" Width="80" Visibility="{Binding IsEnabledAndBad, Converter ={StaticResource boolTovis}}" Background="AliceBlue">
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="LostFocus" >
                                    <cmd:EventToCommand Command="{Binding MeasurmentViewModel.LostFocusCommand, Mode=TwoWay, Source={StaticResource Locator}}" PassEventArgsToCommand="True" />
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                        </controls:NumberTextbox>
                        <toolkit:MaskedTextBox Mask ="-99999999" Value="{Binding Value,  Converter ={StaticResource EmptyStringToNullConverter}, UpdateSourceTrigger=PropertyChanged}" PromptChar=" "  Height="22" Width="80" Visibility="{Binding IsEnabledAndGood, Converter ={StaticResource boolTovis}}"   IncludeLiterals="True" IncludePrompt="False" Background="AliceBlue" ValueType="{x:Type sys:Int64}" GotFocus="MaskedTextBox_GotFocus_1" SelectionChanged="MaskedTextBox_SelectionChanged_1">

                        </toolkit:MaskedTextBox>
                    </StackPanel>
                </DataTemplate>
            </DataTemplate.Resources>
            <StackPanel >

                <Label BorderBrush="{x:Static SystemColors.ControlLightBrush}" BorderThickness="1" Padding="1" Height="22" Width="160" Content="{Binding YieldInput}" Background="Moccasin"/>
                <Label BorderBrush="{x:Static SystemColors.ControlLightBrush}" BorderThickness="1" Padding="1" Height="22" Width="160" Content="{Binding YieldOutput}" Background="Moccasin"/>
                <Label BorderBrush="{x:Static SystemColors.ControlLightBrush}" BorderThickness="1" Padding="1" Height="22" Width="160" Content="{Binding Yield}" Background="Moccasin"/>

                <ItemsControl ItemsSource="{Binding Stations}" ItemTemplate="{StaticResource It1}">

                </ItemsControl>
            </StackPanel>
        </DataTemplate>

这是手风琴项目本身:

                        <System_Windows_Controls:Accordion  ContentTemplate="{StaticResource Cont}"  ItemTemplate="{StaticResource Head}" ItemsSource="{Binding Cells}"  SelectedIndex="{Binding SelectedAccItem, Mode=TwoWay}" SelectionMode="{Binding MeasurmentViewModel.SelectionMode, Source={StaticResource Locator}}" HorizontalAlignment="Stretch" >
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="SelectedItemsChanged" >
                                    <cmd:EventToCommand Command="{Binding MeasurmentViewModel.SelectedItemsChangedCommand, Mode=TwoWay, Source={StaticResource Locator}}" PassEventArgsToCommand="True"   />
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                        </System_Windows_Controls:Accordion>

这种行为的原因可能是什么?

4

1 回答 1

0

根据您对丢失TextBoxes 不占用任何空间的描述,我只能假设您拥有TriggerConverter附加到他们的Visibility财产。Converter如果你在附加到有问题的那个中放置一个断点TextBox,那么你可以很容易地调试这是否是原因。我假设bool您在属性中绑定的值Visibility设置不正确......请检查这是否属实。

于 2013-09-06T09:18:01.220 回答