簡體   English   中英

Windows Phone 8.1 LongListSelector問題與按鈕

[英]Windows phone 8.1 LongListSelector issue with button

我實現了LongListSelector控制器而不是ListView控制器,因為我正在使用Windows Phone Silverlight應用程序。

我想將Name綁定到Button控制器。 但是我無法完成它。

<Button  Name="{Binding Name}" Content="Download" Grid.Row="2" Grid.Column="1" Click="Button_Click_1" Width="170" Height="70" Background="#b3c833"></Button>

我為TextBoxImage成功為LongListSelector控制器。

任何建議將不勝感激。

public class Station
{
    //  private string _stationName;

    private string _stationName;
    //  private BitmapImage bm = new BitmapImage(new Uri(@"Image/Darktheme.png", UriKind.RelativeOrAbsolute));
    private Uri bm;
    private string btnop;
    public Uri ImageUrl
    {
        get { return bm; }
        set { bm = value; }
    }

    public string Name
    {
        get { return _stationName; }
        set { _stationName = value; }
    }
    public string btnop1
    {
        get { return btnop; }
        set {
            btnop = value; }
    }
    public Station( Uri bm,string station, string ty)
    {
        this.Name = station;
    this.ImageUrl = bm;
        this.btnop1 = ty;
    }
}


ObservableCollection<Station> trainStations = new ObservableCollection<Station>();
trainStations.Add(new Station(new Uri("Assets/pdfdoc.png", UriKind.RelativeOrAbsolute),d, word));   

根據MSDN,使用FrameworkElement.Tag屬性。

FrameworkElement.Tag獲取或設置一個任意的對象值,該值可用於存儲有關此元素的自定義信息。

頁面清楚地說明。 只能綁定到DependencyProperty 它不適用於x:Name

如果要遍歷LongListSelector ,可以將Name成員綁定到Tag屬性。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM