-1
編輯:綁定我逼瘋了
的XAML:
<TextBlock Text="{Binding Path=CurrentShows}" Grid.Row="1"/>
產生以下輸出:
SilverlightHelloWorld.Deserialize.schedule
的XAML:
<TextBlock Text="{Binding Path=CurrentShows.Today}" Grid.Row="1"/>
也不
<TextBlock Text="{Binding Path=CurrentShows.Today.Date}" Grid.Row="1"/>
在調試模式下產生任何錯誤或輸出。
Anysuggestions?
OldStatement:
我有一個安靜以及複雜的例子在這裏, 最好的將是,我開始與我的代碼。
這是我隱藏:
MainPage.xaml.cs中
schedule currentshows;
public schedule CurrentShows
{
protected set
{
if (currentshows != value)
{
currentshows = value;
OnPropertyChanged("CurrentShows");
}
}
get
{
return currentshows;
}
}
schedule.cs
[XmlRoot]
public class schedule : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
DayCollection today;
[XmlElement("DAY")]
public DayCollection Today
{
set
{
if (today != value)
{
today = value;
OnPropertyChanged("Today");
}
}
get
{
return today;
}
}
private void OnPropertyChanged(string p)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(p));
}
}
DayCollection.cs
public class DayCollection : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
ObservableCollection<TimeCollection> timecol;
[XmlElement("time")]
public ObservableCollection<TimeCollection> TimeCol
{
set
{
if (timecol != value)
{
timecol = value;
OnPropertyChanged("TimeCol");
}
}
get
{
return timecol;
}
}
string date;
[XmlAttribute(AttributeName = "attr")]
public string Date
{
set
{
if (date != value)
{
date = value;
OnPropertyChanged("Date");
}
}
get
{
return date;
}
}
private void OnPropertyChanged(string p)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(p));
}
}
我試圖讓字符串屬性「Da te「在我的Xaml中展示。 但我只是沒有得到任何解決方案。
我完全希望在這裏得到任何幫助,在此先感謝!
你需要做的第一件事是打開了調試信息的綁定:HTTP://我.stack.imgur.com/MF8i5.png接下來,重新運行並檢查輸出窗口,看看有哪些錯誤。 – Will 2012-02-23 19:24:37
這不是標準嗎?那麼,我再次檢查,甚至錯誤地把它們變成了錯誤,它很好地編譯。沒有錯誤,沒有警告,沒有任何東西。 – user1021605 2012-02-23 19:30:24
不,編譯時不在運行時。 – Will 2012-02-23 19:32:37