how to save hyperlink button in isolated storage

后端 未结 2 1274
走了就别回头了
走了就别回头了 2021-01-26 01:21

I have a list of hyperlink button, created at runtime

public void SaveBookmark()
        {
            Button objButton = new Button();
            objButton.Con         


        
2条回答
  •  孤街浪徒
    2021-01-26 01:57

    Well if I am getting your point correctly then. make a wrapper class first

     public class HypProperties
        {
         public string contentText{get;Set;}
        public double Height{get;Set;}
        public double Width{get;Set;}
    //othere properties add according to requirements
        }
    

    Now You can use IsolatedStorageSettings.ApplicationSettings to save an object inside. Sample- To save -

    HypProperties obj=new HypProperties (){contentText="",Height=height,Width=width};
    if(!IsolatedStorageSettings.ApplicationSettings.Contains("KeyName"))
    {
    IsolatedStorageSettings.ApplicationSettings["KeyName"]=obj;
    IsolatedStorageSettings.ApplicationSettings.Save();
    }
    

    To retrieve

    if(IsolatedStorageSettings.ApplicationSettings.Contains("KeyName"))
            {
            HypProperties obj=IsolatedStorageSettings.ApplicationSettings["KeyName"] as HypProperties;
            }
    

    But I would suggest you to just store the properties of that hyperlink button. Saving a UI Element is not the correct way.

提交回复
热议问题