簡體   English   中英

使用TagLib#進行數據綁定

[英]Data Binding with TagLib#

因此,我試圖將TagLib庫與Databinding一起使用,但是在將其轉換為可綁定的屬性時遇到了麻煩。 任何幫助表示贊賞,謝謝。 到目前為止,這里是我所不知道的我做錯了什么:

 public TagLib.File fileToEdit
    {
        get { return (TagLib.File)GetValue(fileToEditProperty); }
        set { SetValue(fileToEditProperty, value); }
    }

    // Using a DependencyProperty as the backing store for fileToEdit.  This enables animation, styling, binding, etc...
    public static readonly DependencyProperty fileToEditProperty =
        DependencyProperty.Register("fileToEdit", typeof(TagLib.File), typeof(TagLib.File), new UIPropertyMetadata(TagLib.File.Create("",TagLib.ReadStyle.None)));

DependencyProperty.Register具有兩個Type參數。 第一個表示屬性的類型( TagLib.File )。 第二種是您的班級類型(您尚未列出,所以我不能告訴您那是什么)。 將第二個參數更改為typeof(YourClass) ,您應該能夠綁定屬性並在代碼中使用它。

暫無
暫無

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

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