静态类的静态属性的双向绑定

时间:2017-07-14 04:55:27

标签: c# wpf xaml binding two-way-binding

在双向模式下绑定静态类的静态属性有什么好方法吗?

以下是一个示例类:

def rcp_poll_data(xml):

#first lets get a beautifulsoup object so that we can manipulate the data
soup = BeautifulSoup(xml, 'html.parser')

#test to see that our soup object is working..
print type(soup)
print soup.prettify()

#declare the dictionary to hold all the different columns (that will eventually be changed to a dataframe)
finalResult = {}


#working dictionary version
my_date_dict = {series.attrs["xid"]: series.get_text() for series in soup.find("series").find_all("value") if soup.value.get_text()}

#convert the dictionary into a pandas dataframe. But first we need the keys to access each element

keys = my_date_dict.keys()

#then interate through each item in the dictionary to insert it into the dataframe using the appropriate key

finalResult['date'] = pd.to_datetime([my_date_dict[k] for k in keys])


for item in soup.find_all("graph"):
    print "found a graph tag!"
    print"creating a dict entry..."

    name = item.attrs["title"]

    tempdict = {}    

    tempdict = {item.value.attrs["xid"]: test.get_text() for test in soup.find("graph").find_all("value") if soup.value.get_text()}

    print tempdict

    finalResult[name] = [tempdict[k] for k in keys]

return result

还有一个文本框:

 static class SettingsModel
 {
        static public string ModelFolder { set; get; }
 }

我一直在寻找很多,而且我发现只有2个不是很好的答案:让类不是静态的,或者创建一个虚拟的窗口资源类。

0 个答案:

没有答案