none
C#WPF中 在Expander 控件里增加控件或其它内容不显示,怎么解决? RRS feed

  • 问题

    • C#WPF中 向Data Extensions Expander控件里增加内容不显示,怎么解决?程序未编译,调试之前看不到展开后的内容,很奇怪。运行后能看到Data Extensions Expander控件里的其它控件和内容,没有问题。但是调试前创建Expander,在Expander的Grid内添加其他控件和内容,为什么就不显示呢?请高手解答。
     <Expander Expanded="expdrDataExtentions_Expanded" Header="Data Extensions" Name="expdrDataExtensions" BorderBrush="Black" BorderThickness="1" FontFamily="Arial"  IsEnabled="True" Focusable="True" Height="Auto">
                               <Expander.ContextMenu>
                                  <ContextMenu DataContext="{Binding}" />
                               </Expander.ContextMenu>
                               <Expander.Background>
                                            <LinearGradientBrush EndPoint="0.8,1" StartPoint="0.5,0">
                                                <GradientStop Color="#ddd" Offset="0" />
                                                <GradientStop Color="white" Offset="1" />
                                            </LinearGradientBrush>
                                        </Expander.Background>
                                        <Grid Background="White" x:Name="gridDataExtensions" IsEnabled="True">
                                            <Grid.Resources>
                                                <BooleanToVisibilityConverter x:Key="boolToVisible"/>
                                            </Grid.Resources>
                                            <Border Margin="3,1,1,1" BorderBrush="Black" BorderThickness="1">
                                                <StackPanel Margin="2" Orientation="Vertical" Name="stckPnlDataExtensions">
                                                    <GroupBox Header="Data Extensions" Name="grpbDataExtensions" VerticalAlignment="Top" BorderThickness="1" BorderBrush="Black" >
                                                        <Grid Name="gridDataExtensionsTypes" IsHitTestVisible="True" UseLayoutRounding="False">
                                                            <CheckBox ToolTip="Enable Data Extensions" ToolTipService.ShowOnDisabled="True" Content="EnableDataExtensions" Height="16" HorizontalAlignment="Left" Margin="6,6,0,0" Name="chkDataExtensions" VerticalAlignment="Top" Checked="chkDataExtensions_Checked" Unchecked="chkDataExtensions_Checked" />
                                                            <RadioButton IsEnabled="False" ToolTipService.ShowOnDisabled="True" GroupName="DataExtensions" Content="Stream to TCP port" Height="16" HorizontalAlignment="Left" Margin="25,28,0,0" Name="rdBtnStreamToTcpPort" VerticalAlignment="Top" Checked="rdBtnStreamToTcpPort_Checked" Unchecked="rdBtnStreamToTcpPort_Checked">
                                                                <RadioButton.ToolTip>
                                                                    Streams the tag data to TCP port.
                                                                </RadioButton.ToolTip>
                                                            </RadioButton>
                                                            <TextBox  MaxLength="5" Visibility="Visible" HorizontalAlignment="Left" Margin="161,25,0,0" Name="txtTcpPort" Width="67" Text="9055" Height="23" VerticalAlignment="Top" PreviewTextInput="txtTcpPort_PreviewTextInput" TextChanged="txtTcpPort_TextChanged" LostKeyboardFocus="txtTcpPort_LostKeyboardFocus" />
                                                            <RadioButton IsEnabled="False" ToolTipService.ShowOnDisabled="True" GroupName="DataExtensions" Content="Web Service" Height="16" HorizontalAlignment="Left" Margin="25,58,0,0" Name="rdBtnWebService" VerticalAlignment="Top" Checked="rdBtnWebService_Checked">
                                                                <RadioButton.ToolTip>
                                                                    Enables web streaming.
                                                                </RadioButton.ToolTip>
                                                            </RadioButton>
                                                            <RadioButton IsEnabled="False" ToolTipService.ShowOnDisabled="True" GroupName="DataExtensions" Content="Stream to Serial Port" Height="16" HorizontalAlignment="Left" Margin="25,88,0,0" Name="rdBtnStreamToSerialPort" VerticalAlignment="Top" Checked="rdBtnStreamToSerialPort_Checked">
                                                                <RadioButton.ToolTip>
                                                                    Enables Serial Port Streaming.
                                                                </RadioButton.ToolTip>
                                                            </RadioButton>
                                                            <ComboBox IsEnabled="False" Height="23" HorizontalAlignment="Left" Margin="161,81,0,0" Name="comboBox1" VerticalAlignment="Top" Width="67" />
                                                            <Label IsEnabled="False" Visibility="Hidden" Content="Status:" Height="23" HorizontalAlignment="Left" Margin="3,111,0,0" Name="lblTcpStreamStatus" VerticalAlignment="Top" />
                                                        </Grid>
                                                    </GroupBox>
                                                </StackPanel>
                                            </Border>
                                        </Grid>
                                    </Expander>




    • 已编辑 kuan zhao 2015年11月26日 18:53
    2015年11月26日 18:47