Windows8 App2013. 7. 11. 16:29

 

설정페이지를 커스터마이징하는건 구글에 많았지만 순수 오리지널을 보이게 하는부분은 없었다.

 

간단하다.

 

SettingsPane.Show();

 

셋팅하는건 여기를 참조

 

http://cyanbyfuchsia.wordpress.com/2013/04/29/winrt-settings-with-caliburn-micro/

 

혹은 winrt flyout으로 검색하면 된다.

'Windows8 App' 카테고리의 다른 글

TextBlock에서 라인 띄우는 법  (0) 2013.11.22
T Generic 리턴하기  (0) 2013.10.15
[winrt] dispatcher의 활용  (0) 2013.07.23
[Window 8] 기기 해상도와 DPI 값 얻어오기  (0) 2013.07.05
[win8] 윈8 앱 종료 이벤트  (0) 2013.06.17
Posted by 동동(이재동)
Windows Phone 72012. 1. 26. 11:34

앱을 만들다보면 페이지간의 이동이 필요한 경우가 무척이나 많다.

그럼 어떻게 해서 데이터 전송을 할까?

여러가지 방법이 있는데 헷갈려 하는 사람들이 많아서 정리해보자.

1. Global Variable을 이용하는 방법

이건 쉽고 편리하긴하다.

App.xaml에

public string SecondPageText { get; set; }

이런식으로 정의 하고

(App.Current as App).SecondPageText = txtBox.Text;

이렇게 값을 넣을수 있다.

이렇게 하거나 아니면 Static Class를 만들어서 관리하는 방법도 있다.

 

2. Query String을 이용하는 방법

이건 예전에도 포스팅했고 가장 일반적인 방법임으로 패스

그냥 Navigate할때 쿼리처럼 쓰면 된다. web같이

 

3. PhoneApplicationSerivce States를 이용하는 방법

PhoneApplicationService.Current.State["Text"] = txtBox.Text;

txtBlock.Text = (string)PhoneApplicationService.Current.State["Text"];

머 이렇게 하는법이다. 주로 tombstone할때 사용하던 방식이다.

4. NextPage intance를 이용하는 방법

OnNavigateFrom할때 미리 가는 페이지의 instace를 받아서 보내는방법

viewModel에 직접 전달해줄수도 있어서 유용할수도 있다.

아마 사람들이 잘 모르는 방법일 것이다.

protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e)
{
     base.OnNavigatedTo(e);
     if (e.Content is PageOne)
     {
         (e.Content as PageOne).txtBlock.Text = txtBox.Text;
     }
}

 

윈폰7을 공부하는 사람들이 가장 궁금해 할 수 있는 부분일꺼 같아서 공유해 본다.

Posted by 동동(이재동)
Windows Phone 72011. 3. 24. 16:05

이건 정말 옛날부터 알았던건데 혹시나 까먹을까 해서 쓴다.

 

NavigationServce.Navigate를 이용해서 페이지를 이동할때

 

var uri = new Uri(string.Format("/HugeFlow.Phone.Controls;component/AboutControl/AboutPage.xaml?AppName={0}&Version={1}&SiteAddress={2}&EmailAddress={3}&Year={4}&Company={5}"
                , appName, version, siteAddress, emailAddress, year, companyName), UriKind.RelativeOrAbsolute);

 

이런식으로 파라미터를 줄수 있다 웹과 같다.

 

그렇다면 받는쪽에서는 어떡해 할까?

 

받는 페이지에는

 

protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
       {
           base.OnNavigatedTo(e);
 
           string appName;
           string version;            
           string siteAddress;
           string emailAddress;
           string year;
           string companyName;
 
           if (NavigationContext.QueryString.TryGetValue("AppName", out appName) == true)
           {
               AboutPageControl.AppName = appName;
           }
 
           if (NavigationContext.QueryString.TryGetValue("Version", out version) == true)
           {
               AboutPageControl.Version = version;
           }
 
           if (NavigationContext.QueryString.TryGetValue("SiteAddress", out siteAddress) == true)
           {
               AboutPageControl.SiteAddress = siteAddress;
           }
 
           if (NavigationContext.QueryString.TryGetValue("EmailAddress", out emailAddress) == true)
           {
               AboutPageControl.EmailAddress = emailAddress;
           }
 
           if (NavigationContext.QueryString.TryGetValue("Year", out year) == true)
           {
               AboutPageControl.Year = year;
           }
 
           if (NavigationContext.QueryString.TryGetValue("CompanyName", out companyName) == true)
           {
               AboutPageControl.CompanyName = companyName;
           }
       }

 

이렇게 하면 된다.

Posted by 동동(이재동)