【问题标题】:Enable button on another .xaml page在另一个 .xaml 页面上启用按钮
【发布时间】:2011-07-23 08:04:34
【问题描述】:

我有一个按钮'ReadMore' 定义了Page.xaml。当我单击关闭 ThumbnailDetails.xaml 的按钮时,如何再次启用它?用户选择@aListBox 的项目,顺便将他们定向到ThumbnailDetails.xaml

不知怎的,它不起作用?

Page.xaml.cs:

void NewsList_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
    StaffNews news = (StaffNews) NewsList.SelectedItem;
    if (news != null)
    {
        DetailsView.DataContext = news;
        DetailsView.Visibility = Visibility.Visible;
        //testing!!!
        ReadMore.IsEnabled = false;
    }                   
}

ThumbnailDetails.xaml.cs

//set the Visibility of the UserControl to "Collapsed" - 
//which will cause it to disappear from the screen and 
//return the user to the content below it:
void CloseBtn_Click(object sender, RoutedEventArgs e)
{
    Visibility = Visibility.Collapsed;

    //testing if button ReadMore will be reenabled on closebtn_clicked
    Page a = new Page();
    a.ReadMore.IsEnabled = true;
}

【问题讨论】:

    标签: c# xaml sharepoint-2007 silverlight-2.0


    【解决方案1】:

    可能发生的情况是 Page.xaml 被重新加载,因此状态丢失。您如何将它们“引导”到其他页面?这可能是您的问题,因为 Web 应用程序是无状态的。

    【讨论】:

    • 还是谢谢你!我决定放弃这种方法,因为我无法抽出时间来测试您的解决方案。
    猜你喜欢
    • 2017-07-19
    • 1970-01-01
    • 2018-06-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多