我有用户控制权:
XAML
<UserControl x:Class="controlmaker.checkButton"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="114" d:DesignWidth="221">
<Grid Background="Aqua" >
<CheckBox Content="CheckBox" Height="16" HorizontalAlignment="Left" Margin="58,24,0,0" Name="checkBox1" VerticalAlignment="Top" />
<Button Content="{Binding buttText}" Height="23" HorizontalAlignment="Left" Margin="58,57,0,0" Name="button1" VerticalAlignment="Top" Width="75" />
</Grid>
</UserControl>
Run Code Online (Sandbox Code Playgroud)
代码背后
public partial class checkButton : UserControl
{
public checkButton()
{
InitializeComponent();
}
public static readonly DependencyProperty buttTextProperty =
DependencyProperty.Register("buttText", typeof(String),
typeof(checkButton), new FrameworkPropertyMetadata(string.Empty));
public String buttText
{
get { return GetValue(buttTextProperty).ToString(); }
set { SetValue(buttTextProperty, value); }
}
}
Run Code Online (Sandbox Code Playgroud)
和主窗口xaml
<Window x:Class="controlmaker.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" …Run Code Online (Sandbox Code Playgroud) 我有文本框,文本属性绑定到viewmodel.我已将TextChanged事件绑定到viewmodel.
但问题是事件触发了每个符号都被添加到文本框中(这很好),当文本框失去焦点时,视图模型中的文本会被刷新(这对我不利).
如何在每个符号后刷新此Text属性?
或者如何将发件人作为参数发送?我认为发件人会有更新数据.
我的互动xaml:
<interactivity:Interaction.Triggers>
<interactivity:EventTrigger EventName="TextChanged">
<helpers:CustomCommandInvoker Command="{Binding UnlockChangedCommand}" />
</interactivity:EventTrigger>
</interactivity:Interaction.Triggers>
Run Code Online (Sandbox Code Playgroud)
我正在使用RelayCommand.
我必须在我的程序中读取txt文件.我目前正在使用FileReader和BufferedReader.我尝试使用Scanner,但速度比FileReader和BufferedReader慢.有没有可以更快读取文件的类?它必须用Java语言编写.
我需要从文本文件中读取所有单词(由空格分割的字符串)
我正在学习EasyMock和Mockito的测试.他们之间有什么区别?它们中的任何一个的优点和缺点是什么?哪一个更好用?
我有应用程序,我正在使用后台工作程序来启动一些序列.它有时需要更新GUI.
我有一些静态类,引用了一些gui对象.在我的逻辑中,我想从这个静态类调用方法,使用一些参数,分析它并更新GUI.但我有" 调用线程无法访问此对象,因为不同的线程拥有它. "异常.
在第一个线程中设置变量:
public static void SetCardHand(ref CardHand ch)
{
cardHand = ch;
}
Run Code Online (Sandbox Code Playgroud)
从后台工作线程调用的方法:
private static void SetCoveredCardsPlayer0(int cardsNumber)
{
if (cardsNumber < 1)
cardHand.imgCard1.Source = null;
else
cardHand.imgCard1.Source = (ImageSource)WindowManager.Instance.CardsGUI.CardsDictionary["T1"];
}
Run Code Online (Sandbox Code Playgroud)
如何让这个方法改变GUI?
这不是一个窗口类.它像演示者一样.
它是纸牌游戏.我在后台工作者中启动它,我需要在每笔交易后更新图像源(代表卡).
我有充分数据表的数据,有3列- col1,col2和col3。
当 in 中的值大于 1000 或小于 -1000时,我必须更新数据col3(将其设置为null)col3。我试图迭代每一行并检查这个条件,但它太慢了。我如何提高速度?
我在WPF有项目.
问题是,当我将App.xaml文件移动到子文件夹时,它不想编译,因为它找不到main方法.
如何强制Project使用App.xaml文件中设置的窗口启动应用程序作为启动窗口?
我使用Visual Studio 2010 express.
编辑:
我的App.xaml
<Application x:Class="TraceabilityLoader.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="View/VmainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>
Run Code Online (Sandbox Code Playgroud)
项目中的子文件夹:
查看,模型,ViewModel等....