Silverlight 和不工作未找到附加属性行为
TextBox.Behavior在此属性和按钮中不起作用。Behavior也不能正常工作。请帮助我,我想在同一页上创建一个列表, 因为我正在开发WP7应用程序:待办事项列表Silverlight 和不工作未找到附加属性行为,silverlight,windows-phone-7,xaml,Silverlight,Windows Phone 7,Xaml,TextBox.Behavior在此属性和按钮中不起作用。Behavior也不能正常工作。请帮助我,我想在同一页上创建一个列表, 因为我正在开发WP7应用程序:待办事项列表 <StackPanel Orientation="Horizontal"> <TextBox Name="textBoxNewListName" MaxLength="100"
<StackPanel Orientation="Horizontal">
<TextBox Name="textBoxNewListName"
MaxLength="100"
Height="70"
Text="{Binding NewListName,Mode=TwoWay}"
VerticalAlignment="Top"
Width="400"
FontSize="24"
InputScope="Text"
Background="#BFFFFFFF"
BorderBrush="#BFFFFFFF"
Foreground="Black"
Style="{StaticResource TaskDescriptionTextBoxStyle}">
<TextBox.Behaviors>
<Infrastructure:TextBoxCommand CommandBinding=" {Binding GotFocusCommand}"/>
</TextBox.Behaviors>
</TextBox>
<Button Name="buttonNewList"
Width="62"
HorizontalAlignment="Right"
BorderThickness="0"
Padding="0">
<Image Source="Images\add.png"
Height="35"
Width="35"/>
<Button.Behaviors>
<Infrastructure:ButtonCommand CommandBinding="{Binding AddNewListCommand}"/>
</Button.Behaviors>
</Button>
</StackPanel>
enter code here
using Microsoft.Phone.Controls;
using Microsoft.Practices.Prism.Commands;
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Navigation;
using ToDo.Infrastructure;
using ToDo.ViewModels;
namespace ToDo
{
public partial class MainPage : PhoneApplicationPage
{
public const string MASTERLISTFILENAME = "MasterList.dat";
public MainPage()
{
this.InitializeComponent();
}
private void ApplicationBarMenuItem_About_Click(object sender, EventArgs e)
{
MainViewModel dataContext = base.DataContext as MainViewModel;
if (dataContext != null)
{
dataContext.ShowAboutPageCommand.Execute();
}
}
private void listBoxExistingLists_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
ListViewModel selectedItem = this.listBoxExistingLists.SelectedItem as ListViewModel;
this.listBoxExistingLists.SelectedIndex = -1;
if (selectedItem != null)
{
selectedItem.ShowListPivotPageCommand.Execute();
}
}
private void MainPage_DestinationPageChanged(object sender, PageChangedEventArgs e)
{
base.NavigationService.Navigate(e.Destination);
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
if (base.DataContext == null)
{
base.DataContext = new MainViewModel();
(base.DataContext as MainViewModel).DestinationPageChanged +=
new MainViewModel.PageChangedEventHandler
(this.MainPage_DestinationPageChanged);
this.listBoxExistingLists.DataContext = base.DataContext;
}
}
private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
{
}
}
}
回答我…………用这样模糊的描述很难诊断你的问题。可能有很多事情,比如你的行为本身。首先我要看的是,例如,你如何用object.Behaviors来调用它们,不确定这是否正确?我本来希望看到更像……我已经准备好了,试试这个。。。。 问题没有解决你有没有任何具体的错误或任何可能有助于诊断你的问题的东西?没有,先生,我没有具体的错误。。。。。。。。。。。。。。。