我目前正在使用TextBlock以下命令绑定名为的属性的值Name:
<TextBlock Text="{Binding Name}" />
Run Code Online (Sandbox Code Playgroud)
现在,我想绑定另一个名为ID相同的属性TextBlock.
是否可以将两个或多个值绑定到同一个值TextBlock?是否可以通过简单的连接来完成Name + ID,如果没有,可以如何处理它?
我有两个清单
List<Sent> SentList;
List<Messages> MsgList;
Run Code Online (Sandbox Code Playgroud)
两者都具有相同的属性,称为MsgID;
MsgList SentList
MsgID Content MsgID Content Stauts
1 aaa 1 aaa 0
2 bbb 3 ccc 0
3 ccc
4 ddd
5 eee
Run Code Online (Sandbox Code Playgroud)
我想比较Msglist中的MsgID与发送列表,并需要使用linq不在发送列表中的项目
Result
MsgID Content
2 bbb
4 ddd
5 eee
Run Code Online (Sandbox Code Playgroud) 我在usercontrol中创建了一个Dependency Property,但是usercontrol中的更改未通知Viewmodel
用户控件
<UserControl x:Class="DPsample.UserControl1"
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="300" d:DesignWidth="300">
<Grid>
<TextBox x:Name="txtName"></TextBox>
</Grid>
Run Code Online (Sandbox Code Playgroud)
UserControl.cs
/// <summary>
/// Interaction logic for UserControl1.xaml
/// </summary>
public partial class UserControl1 : UserControl
{
public UserControl1()
{
InitializeComponent();
}
#region SampleProperty
public static readonly DependencyProperty SamplePropertyProperty
= DependencyProperty.Register("SampleProperty",
typeof(string),
typeof(UserControl1),
new PropertyMetadata(OnSamplePropertyChanged));
public string SampleProperty
{
get { return (string)GetValue(SamplePropertyProperty); }
set { SetValue(SamplePropertyProperty, value); }
}
static void OnSamplePropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
{
(obj as UserControl1).OnSamplePropertyChanged(e);
}
private void OnSamplePropertyChanged(DependencyPropertyChangedEventArgs …Run Code Online (Sandbox Code Playgroud) 如何在此日期时间范围内选择以ms访问的数据
喜欢select*from logevents,其中logTime> = '12/6/2012 3:54:15 PM'
logTime是Datetime字段
海
我有一个WPF用户控件,当我在另一个窗口中使用该控件时它加载两次,所以它为我抛出异常,因为它在usercontrol_loaded事件中有一些功能,当它加载两次抛出错误时,有没有其他方法可以检查如果像这样加载usercontrol,否则如何解决这个问题.
我使用ClickOnce发布来部署我的WPF应用程序
当我尝试手动更新时
该ApplicationDeployment.IsNetworkDeployed is always return false所以它不检查更新.它无法找到当前的部署设置
我使用以下方法手动更新 http://msdn.microsoft.com/en-us/library/ms404263.aspx
如何编写包含msaccess数据库的查询
我的桌子有列值'CHOPE PARMA TERA 101'
我在PARMA中的搜索关键字.
如何编写包含查询以检索记录?
我正在尝试在WPF中播放音频文件,我目前正在使用以下代码:
FileTextBox.Text = selectedFileName;
MediaPlayer mp = new MediaPlayer();
mp.Open(new Uri(selectedFileName, UriKind.Relative ));
mp.Play();
Run Code Online (Sandbox Code Playgroud)
它运行良好,除了它不播放声音.我究竟做错了什么?
Am使用列表框项目中的复选框,如何从列表中获取所选复选框
<ListBox ItemsSource="{Binding NameList}" HorizontalAlignment="Left" Margin="16,68,0,12" Name="listBox1" Width="156" IsEnabled="True" SelectionMode="Multiple" Focusable="True" IsHitTestVisible="True" IsTextSearchEnabled="False" FontSize="12" Padding="5" SelectionChanged="listBox1_SelectionChanged">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<CheckBox Content="{Binding Path=CNames}" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
Run Code Online (Sandbox Code Playgroud)
我试图循环通过listboxitems中的选定项目,但它在listboxitem中抛出异常
private void btnSelected(object sender, RoutedEventArgs e)
{
foreach (ListBoxItem item in listBox1.Items)
{
if (item.ToString() == "true")
{
MessageBox.Show(item.Content.ToString());
}
}
}
Run Code Online (Sandbox Code Playgroud)