Click here to Skip to main content
11,496,146 members (356 online)
Click here to Skip to main content
Add your own
alternative version

WPF Persistency

, 3 Jan 2013 CPOL 51.2K 574 58
This article describes how to persist WPF dependency properties
The site is currently in read-only mode for maintenance. Posting of new items will be available again shortly.
<Window x:Class="WpfPersist.Demo.MainWindow"
        Height="{app:UserSettings Default=300}" Width="{app:UserSettings Default=400}"
        Top="{app:UserSettings}" Left="{app:UserSettings}"
            <ColumnDefinition Width="{app:UserSettings Default=100}" />
            <ColumnDefinition />
            <RowDefinition />

        <StackPanel Grid.Column="0" Grid.Row="0" Background="AliceBlue">
            <GroupBox Margin="4" Header="TextBox">
                <TextBox Margin="4" Text="{app:UserSettings default text}" />
            <GroupBox Margin="4" Header="CheckBox">
                    <CheckBox Margin="4" IsChecked="{app:UserSettings}">Check1</CheckBox>
                    <CheckBox Margin="4" IsChecked="{app:UserSettings}">Check2</CheckBox>
            <GroupBox Margin="4" Header="RadioButton">
                    <RadioButton Margin="4" IsChecked="{app:UserSettings Default='True'}">Radio1</RadioButton>
                    <RadioButton Margin="4" IsChecked="{app:UserSettings Default='False'}">Radio2</RadioButton>

        <GridSplitter ResizeBehavior="CurrentAndNext" Width="2" ResizeDirection="Columns" VerticalAlignment="Stretch" HorizontalContentAlignment="Right" />

        <DockPanel Grid.Column="1" Grid.Row="0" >
            <TextBox Margin="4" DockPanel.Dock="Bottom" Name="tbLocalPath" IsReadOnly="True" Text="{Binding Path='ExeLocalConfigPath', Mode='OneTime'}" />
            <ListView Name="lvProcesses">
                    <GridView >
                          DisplayMemberBinding="{Binding Mode=OneTime,Path=ProcessName}"
                          Width="{app:UserSettings Default=100, Key=Window1.ListView0.Col0.Width }" />
                          DisplayMemberBinding="{Binding Mode=OneTime,Path=Id}"
                          Width="{app:UserSettings Default=100, Key=Window1.ListView0.Col1.Width}" />
                          DisplayMemberBinding="{Binding Mode=OneTime,Path=MainWindowTitle}"
                          Width="{app:UserSettings Default=Auto, Key=Window1.ListView0.Col2.Width}" />

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Reto Ravasio

Switzerland Switzerland
No Biography provided

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150520.1 | Last Updated 3 Jan 2013
Article Copyright 2007 by Reto Ravasio
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid