小编use*_*773的帖子

如何将WPF TextBox绑定到作为应用程序主窗口成员的属性

我有一个私人领域

private static Double myValue;
Run Code Online (Sandbox Code Playgroud)

在应用程序MainWindow类中.并且(在MainWindow类中)我定义了一个属性

public static Double MytValue
{
    get { return myValue; }
}
Run Code Online (Sandbox Code Playgroud)

在MainWindow类的结构中,我有一个TextBox.我需要将它绑定到MytValue属性.在XAML中我写道:

<TextBox Name="tbxMyValue" Grid.Row="1" Grid.Column="2" TextAlignment="Center"
         Text="{Binding Path=MyValue}" Width="Auto" Margin="10,0,10,15" IsEnabled="True" />
Run Code Online (Sandbox Code Playgroud)

但它没有效果.当myValue变量有值时,我在TextBox中看不到任何内容.为什么?请帮我.

.net c# wpf xaml binding

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

如何在MFC基于对话框的应用程序中关闭主窗口

当我想关闭应用程序本身时,有人可以回答如何关闭MFC基于对话框的应用程序中的主窗口吗?该应用程序是在MS VS 2010中创建的.非常感谢您提前.

尤金.

c++ mfc

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

标签 统计

.net ×1

binding ×1

c# ×1

c++ ×1

mfc ×1

wpf ×1

xaml ×1