Friday, November 2, 2007

Working with cookies in XBAP

2 methods to access cookies ie get and set

Application.GetCookie
Application.SetCookie

Application.GetCookie will raise exception if the cookie is not present..

Thursday, November 1, 2007

Remove control box of Paged WPF applications

  • Get the instance of the current Window from Application.Current and remove it's Control box by setting WindowStyle=None.

    public partial class Page1 : System.Windows.Controls.Page
    {
    public Page1()
    {

    this.Loaded += new RoutedEventHandler(Page1_Loaded);
    InitializeComponent();
    }

    void Page1_Loaded(object sender, RoutedEventArgs e)
    {
    Application.Current.MainWindow.WindowStyle = WindowStyle.None;
    }

    }

    Application.Current.MainWindow will be initialized only in Loaded event of Page

  • <Application.Resources>
    <Style TargetType ="{x:Type NavigationWindow}">
    <Setter Property ="WindowStyle" Value="None"/>
    </Style>
    </Application.Resources>