我的视觉树中有一个文本框如下..
Window
Grid
ListBox
ItemTemplate
DataTemplate
Grid
Grid
Textbox... <TextBox Height="Auto"
Text="{Binding Path=LyricsForDisplay}"
MinHeight="50"
MaxHeight="400"
Visibility="Visible"
VerticalScrollBarVisibility="Auto"
IsReadOnly="True"
AllowDrop="False"
TextWrapping="WrapWithOverflow">
</TextBox>
Run Code Online (Sandbox Code Playgroud)
当长文本添加到绑定变量(LyricsForDisplay)时,列表框中的所有项目都会展开它们的文本框/网格宽度,以便在使用出现的底部的滚动条时可以看到整个字符串...
我想做的是让它如此框/网格只有在用户拉伸窗口时才会调整大小..不是在输入长文本时(它可能只是环绕......)
有谁知道如何获得功能?
我有一个Grid元素,有两列和三行.最后一行的高度为0 ...我使用自定义动画类为height属性设置动画,因为gridheight属性不是整数.
动画工作得很好,但是当我激活它时,它会改变第二列的宽度看似随机...有时只有几个像素更大,有时会超过两倍宽...
这是网格代码
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="50"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*" />
<RowDefinition Height="7"/>
<RowDefinition Name="LyricsRow" Height="1">
<RowDefinition.Style>
<Style>
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsTrayOpen}" Value="True">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<local:GridLengthAnimation
Storyboard.TargetProperty="Height"
From="0" To="150" Duration="0:0:0.3" >
</local:GridLengthAnimation>
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
<DataTrigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<local:GridLengthAnimation
Storyboard.TargetProperty="Height"
From="150" To="0" Duration="0:0:0.5" />
</Storyboard>
</BeginStoryboard>
</DataTrigger.ExitActions>
</DataTrigger>
</Style.Triggers>
</Style>
</RowDefinition.Style>
</RowDefinition>
</Grid.RowDefinitions>
Run Code Online (Sandbox Code Playgroud)
这有什么理由可以继续下去吗?
我试图使用相同的MISO,MOSI和CLOCK引脚同时控制两个SPI器件,但不同的SS引脚.
一个是来自SparkFun的Wifly 屏蔽,它使用SPI-to-UART芯片,另一个是MAX31855.
他们独立工作,但不是一起工作..
我正在使用的SPI-to-UART代码如下所示.我所做的唯一更改是在头文件中; 我设定select()并deselect()公开.
#include "SpiUart.h"
// See section 8.10 of the datasheet for definitions
// of bits in the Enhanced Features Register (EFR)
#define EFR_ENABLE_CTS 1 << 7
#define EFR_ENABLE_RTS 1 << 6
#define EFR_ENABLE_ENHANCED_FUNCTIONS 1 << 4
// See section 8.4 of the datasheet for definitions
// of bits in the Line Control Register (LCR)
#define LCR_ENABLE_DIVISOR_LATCH 1 << 7
// The original crystal …Run Code Online (Sandbox Code Playgroud)