顯示具有 WPF 標籤的文章。 顯示所有文章
顯示具有 WPF 標籤的文章。 顯示所有文章

2012年6月10日 星期日

WPF 設定Install project 的部屬專案屬性


WPF 設定Install project 的部屬專案屬性,指定專案的製造商名稱(Manufacturer Name)

小妹我實在找了很久,終於發現必須在方案總管的頁籤中點選install project ,再直接切換到屬性頁籤,就可以看到設定Manufacturer Name的地方囉!



2011年10月6日 星期四

WPF 設定應用程式icon

視窗的圖示:


<Window Icon="/PostManager;component/images/barcode.ico" />

安裝後,程式集上面的圖示:

至專案「properties」中,應用程式分頁中「資源」作設定。

2011年9月22日 星期四

如何讓expander展開後,Focus子項目

如何讓expander展開後,就Focus在子項目


說明:若將textbox1.Focus()直接寫在expander的expanded裡會回傳false,因為在展開時,該textbox1並未看的見,故無法focus();


作法:
1.建立一個boolean值,控制是否要focus。如beFocus = false;
2.於expander的Expanded事件中,將beFocus設為true;
3.於要被Focus的子項目之IsVisibleChanged事件中,撰寫若visible = true 則focus 自己,並將beFocus改回false。

Example

private bool beFocus = false;


 private void expander1_Expanded(object sender, RoutedEventArgs e)
 {
       beFocus = true;
}

private void textbox1_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
{
     if (((bool)e.NewValue == true) && beFocus) {
           textbox1_.Focus();
           beFocus = false;
     }
}