小编GTD*_*GTD的帖子

绑定UpdateSourceTrigger = Explicit,在程序启动时更新源

我有以下代码:

<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Grid>
    <TextBox Text="{Binding Path=Name, 
                            Mode=OneWayToSource, 
                            UpdateSourceTrigger=Explicit, 
                            FallbackValue=default text}" 
             KeyUp="TextBox_KeyUp" 
             x:Name="textBox1"/>
</Grid>
Run Code Online (Sandbox Code Playgroud)

    public partial class Window1 : Window
{
    public Window1()
    {
        InitializeComponent();
    }

    private void TextBox_KeyUp(object sender, KeyEventArgs e)
    {
        if (e.Key == Key.Enter)
        {
            BindingExpression exp = this.textBox1.GetBindingExpression(TextBox.TextProperty);
            exp.UpdateSource();
        }
    }
}



    public class ViewModel
{
    public string Name
    {
        set
        {
            Debug.WriteLine("setting name: " + value);
        }
    }
}



    public partial class App : Application
{
    protected override void OnStartup(StartupEventArgs …
Run Code Online (Sandbox Code Playgroud)

wpf binding explicit updatesourcetrigger

6
推荐指数
1
解决办法
2万
查看次数

Oracle的示例数据库模式

是否有适用于Oracle的示例数据库,如AdventureWorks for MS SQL?我搜索过Oracle网站,但没有找到任何示例数据库.

oracle sample

6
推荐指数
2
解决办法
2万
查看次数

从GPS读取NMEA语句

我有一台Mio P550设备,其中包含GPS.我尝试使用SerialPort来获取NMEA句子,只需使用SerialPort.Read()即可.数据以一些奇怪的编码返回.GPS应该以ASCII格式返回NMEA句子,但事实并非如此.这是我的阅读代码:

                dataLength = this.serialPort.Read(buffor, 0, Gps.BUFFOR_LENGTH);
                Debug.WriteLine("data length: " + dataLength);

                if (dataLength > 0)
                {
                    for (int i = 0; i < dataLength; i++)
                    {
                        char c = Convert.ToChar(buffor[i]);

                        if (c == '\r' || c == '\n')
                        {
                            string data = stringBuilder.ToString();
                            Debug.WriteLine("data readed: " + data);

                            if (data.StartsWith("$GPGGA"))
                            {
                                this.OnLocationChanged(data);
                            }

                            stringBuilder.Length = 0;
                        }
                        else
                        {
                            stringBuilder.Append(c);
                        }

                        Debug.WriteLine("readed data: " + stringBuilder.ToString());
                    }
Run Code Online (Sandbox Code Playgroud)

以下是我得到的样本值:xæææxfæ`æxæføøøxxxøx

我还有第二个设备(华硕A636N),它返回ASCII的NMEA句子,我的代码效果很好.

我与Mio设备有什么关系来获得ASCII的NMEA句子?或者我如何获取设备返回的数据的编码?我尝试使用System.Text.Encoding.xxx.GetString()中的所有类从readed字节获取字符串,但它不返回正确的数据 - 它返回类似于上面示例的数据.

c# gps nmea

3
推荐指数
1
解决办法
4218
查看次数

ASP.NET导航到后面的代码锚点

我有一个简单的Web窗体,代码如下:

//...
//tons of text
//...
<a name="message" />
//...
//tons of text
//...
<asp:Button ID="ButtonSend" 
                runat="server" 
                text="Send"
                onclick="ButtonSend_Click" />
Run Code Online (Sandbox Code Playgroud)

POST后我想导航用户到我的主播"消息".我有以下代码:

protected void ButtonSend_Click(object sender, EventArgs e)
{
this.ClientScript.RegisterStartupScript(this.GetType(),
                                        "navigate",
                                        "window.location.hash='#message';",
                                        true);
}
Run Code Online (Sandbox Code Playgroud)

这个简单的JavaScript在Firefox 3.5.2中不起作用 - url在浏览器中更改但页面未导航到锚点.在IE 8中它完美运行.

为什么这个JavaScript代码在Firefox中不起作用?我错过了什么吗?

javascript asp.net anchor

3
推荐指数
2
解决办法
1万
查看次数

WPF DropShadowEffect with allowsTransparency ="True"

我想在上面创建非矩形窗口DropShadowEffect.我发现这篇文章是怎么做到的.但DropShadowEffect运行此代码时未显示.在屏幕截图中,您可以看到它DropShadowEffect存在,但它不适合我.

我怎么可以使用DropShadowEffectAllowsTransparency设置为TRUE?

wpf styles dropshadow

1
推荐指数
1
解决办法
6250
查看次数