我想在Grid的各个方面设置阴影效果.
我正在使用控件的DropShadowEffect属性来设置阴影.
我发现的是Direction属性设置控件周围的阴影.
<Grid x:Name="LayoutRoot" Background="#F4F2F1" Width="300" Height="300">
<Grid.Effect>
<DropShadowEffect BlurRadius="300"
Color="#877b77"
Opacity="100"
ShadowDepth="10"
Direction="0" />
</Grid.Effect>
</Grid>
Run Code Online (Sandbox Code Playgroud)
我得到的输出是
如下
我希望阴影出现在Grid的各个方面.
如何将阴影设置为所有方向?
我想在silverlight中设计一个数字文本框.
我添加了TextBox的keydown事件来处理keypress.
在内部事件中,我验证在文本框中输入的密钥.
事件如下
private void TextBox_KeyDown(object sender, KeyEventArgs e)
{
if (!this.Validate(sender,e))
e.Handled = true;
}
Run Code Online (Sandbox Code Playgroud)
功能验证如下
private bool Validate(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter) //accept enter and tab
{
return true;
}
if (e.Key == Key.Tab)
{
return true;
}
if (e.Key < Key.D0 || e.Key > Key.D9) //accept number on alphnumeric key
if (e.Key < Key.NumPad0 || e.Key > Key.NumPad9) //accept number fomr NumPad
if (e.Key != Key.Back) …
Run Code Online (Sandbox Code Playgroud)