Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

WPF: beginner question ... remember values in textbox

Closed Thread
 
Thread Tools Display Modes
Old 08-01-2007   #1 (permalink)
Steve B.
Guest


 

WPF: beginner question ... remember values in textbox

Hi,

With c# V2 in windows apps, I used to bind textboxes in configuration
screens to a settings in the app configuration file using the property grid
and its databindings category. I also save the settings each time the focus
leave the textbox. The idea was to remember the latest values in the
textbox.

Is there any easy way to do the same using WPF ?

Thanks in advance,
Steve


Old 08-02-2007   #2 (permalink)
thelemmings@gmail.com
Guest


 

Re: WPF: beginner question ... remember values in textbox

Hi,

You could bind your TextBox's Text property to a .NET object's
property. This property's get and set accessors would in turn deal
with your AppSettings.

Something like:

<TextBox DataContext=myConfigurationObject Text="{Binding
Path=MyProperty}"/>
(Actually, I'd set DataContext higher up so that multiple TextBoxes
can use it without explicitely specifying DataContext over and over
again)

Luc

On Aug 1, 9:32 am, "Steve B." <steve_bea...@com.msn_swap> wrote:
> Hi,
>
> With c# V2 in windows apps, I used to bind textboxes in configuration
> screens to a settings in the app configuration file using the property grid
> and its databindings category. I also save the settings each time the focus
> leave the textbox. The idea was to remember the latest values in the
> textbox.
>
> Is there any easy way to do the same using WPF ?
>
> Thanks in advance,
> Steve



Old 08-03-2007   #3 (permalink)
Steve B.
Guest


 

Re: WPF: beginner question ... remember values in textbox

Thanks,
I try this solution


<thelemmings@gmail.com> wrote in message
news:1186094727.713579.39930@q3g2000prf.googlegroups.com...
> Hi,
>
> You could bind your TextBox's Text property to a .NET object's
> property. This property's get and set accessors would in turn deal
> with your AppSettings.
>
> Something like:
>
> <TextBox DataContext=myConfigurationObject Text="{Binding
> Path=MyProperty}"/>
> (Actually, I'd set DataContext higher up so that multiple TextBoxes
> can use it without explicitely specifying DataContext over and over
> again)
>
> Luc
>
> On Aug 1, 9:32 am, "Steve B." <steve_bea...@com.msn_swap> wrote:
>> Hi,
>>
>> With c# V2 in windows apps, I used to bind textboxes in configuration
>> screens to a settings in the app configuration file using the property
>> grid
>> and its databindings category. I also save the settings each time the
>> focus
>> leave the textbox. The idea was to remember the latest values in the
>> textbox.
>>
>> Is there any easy way to do the same using WPF ?
>>
>> Thanks in advance,
>> Steve

>
>



Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
VB.NET beginner Question a .NET General 4 06-29-2008 03:42 PM
Copying Textbox values in Gridview with Javascript shawn .NET General 0 04-08-2008 11:31 AM
Question about WMI from a scripting beginner... akcorr PowerShell 5 01-23-2008 12:25 PM
WPF beginner question lallous Avalon 13 08-17-2007 03:19 AM
General beginner question jering PowerShell 2 02-04-2007 01:54 PM








Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50