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

UserControl cannot bind to its own properties?

Closed Thread
 
Thread Tools Display Modes
Old 01-31-2006   #1 (permalink)
lubomir@gmail.com
Guest


 

UserControl cannot bind to its own properties?

Basicaly I have an user control that defines a string DependenyProperty
Caption. In the xaml i have the following code:

<UserControl x:Class="PlasmaBox.TrackHeaderView"
xmlns="http://schemas.microsoft.com/winfx/avalon/2005"
xmlns:x="http://schemas.microsoft.com/winfx/xaml/2005"
Name="xyz"
>

<UserControl.FixedTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="50"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>

<Button Grid.Column="1" Grid.Row="0"/>
<Button Grid.Column="1" Grid.Row="1"/>
<TextBlock
Grid.Column="0"
Grid.RowSpan="2"
VerticalAlignment="Center"
Text="{Binding ElementName=xyz,Path=Caption}"/>
</Grid>
</UserControl.FixedTemplate>
</UserControl>

The Text comes up empty. I've tried al variations of binding with no
luck at all. Is this broken in the December CTP - (if yes, is there a
workaround), or am I doing something wrong?

Thanx,
Lubomir

Old 01-31-2006   #2 (permalink)
Nick Kramer [MSFT]
Guest


 

Re: UserControl cannot bind to its own properties?

I'm guessing the name xyz can't be found in the context you used it,
although it's too late in the day for me to be sure <g>.

--
-Nick Kramer [MSFT]
http://blogs.msdn.com/nickkramer

---
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm


<lubomir@gmail.com> wrote in message
news:1137172194.967723.110270@o13g2000cwo.googlegroups.com...
> Basicaly I have an user control that defines a string DependenyProperty
> Caption. In the xaml i have the following code:
>
> <UserControl x:Class="PlasmaBox.TrackHeaderView"
> xmlns="http://schemas.microsoft.com/winfx/avalon/2005"
> xmlns:x="http://schemas.microsoft.com/winfx/xaml/2005"
> Name="xyz"
> >

> <UserControl.FixedTemplate>
> <Grid>
> <Grid.ColumnDefinitions>
> <ColumnDefinition Width="*"/>
> <ColumnDefinition Width="50"/>
> </Grid.ColumnDefinitions>
> <Grid.RowDefinitions>
> <RowDefinition/>
> <RowDefinition/>
> </Grid.RowDefinitions>
>
> <Button Grid.Column="1" Grid.Row="0"/>
> <Button Grid.Column="1" Grid.Row="1"/>
> <TextBlock
> Grid.Column="0"
> Grid.RowSpan="2"
> VerticalAlignment="Center"
> Text="{Binding ElementName=xyz,Path=Caption}"/>
> </Grid>
> </UserControl.FixedTemplate>
> </UserControl>
>
> The Text comes up empty. I've tried al variations of binding with no
> luck at all. Is this broken in the December CTP - (if yes, is there a
> workaround), or am I doing something wrong?
>
> Thanx,
> Lubomir
>



Old 01-31-2006   #3 (permalink)
Lubo
Guest


 

Re: UserControl cannot bind to its own properties?

I've tried it with or without name, the question stands - How do I declare
the binding in the UserControl so in the visual elements in the FixedTemplate
I can bind to the user control properties?

Thanx.
Lubo

"Nick Kramer [MSFT]" wrote:

> I'm guessing the name xyz can't be found in the context you used it,
> although it's too late in the day for me to be sure <g>.
>
> --
> -Nick Kramer [MSFT]
> http://blogs.msdn.com/nickkramer
>
> ---
> This posting is provided "AS IS" with no warranties, and confers no rights.
> Use of included script samples are subject to the terms specified at
> http://www.microsoft.com/info/cpyright.htm
>
>
> <lubomir@gmail.com> wrote in message
> news:1137172194.967723.110270@o13g2000cwo.googlegroups.com...
> > Basicaly I have an user control that defines a string DependenyProperty
> > Caption. In the xaml i have the following code:
> >
> > <UserControl x:Class="PlasmaBox.TrackHeaderView"
> > xmlns="http://schemas.microsoft.com/winfx/avalon/2005"
> > xmlns:x="http://schemas.microsoft.com/winfx/xaml/2005"
> > Name="xyz"
> > >

> > <UserControl.FixedTemplate>
> > <Grid>
> > <Grid.ColumnDefinitions>
> > <ColumnDefinition Width="*"/>
> > <ColumnDefinition Width="50"/>
> > </Grid.ColumnDefinitions>
> > <Grid.RowDefinitions>
> > <RowDefinition/>
> > <RowDefinition/>
> > </Grid.RowDefinitions>
> >
> > <Button Grid.Column="1" Grid.Row="0"/>
> > <Button Grid.Column="1" Grid.Row="1"/>
> > <TextBlock
> > Grid.Column="0"
> > Grid.RowSpan="2"
> > VerticalAlignment="Center"
> > Text="{Binding ElementName=xyz,Path=Caption}"/>
> > </Grid>
> > </UserControl.FixedTemplate>
> > </UserControl>
> >
> > The Text comes up empty. I've tried al variations of binding with no
> > luck at all. Is this broken in the December CTP - (if yes, is there a
> > workaround), or am I doing something wrong?
> >
> > Thanx,
> > Lubomir
> >

>
>
>

Old 01-31-2006   #4 (permalink)
JosephCooney
Guest


 

Re: UserControl cannot bind to its own properties?

Hi Lubo - I tried to solve your problem but without any success. I found a
couple of links to people solving very simmilar-sounding problems. Maybe they
can provide you with some insights.

http://forums.microsoft.com/MSDN/Sho...45890&SiteID=1

http://groups.google.com.au/group/mi...6553e251576df2

http://groups.google.com.au/group/mi...ee4a2df6cb0a71

Good Luck
Joseph Cooney

"Lubo" wrote:

> I've tried it with or without name, the question stands - How do I declare
> the binding in the UserControl so in the visual elements in the FixedTemplate
> I can bind to the user control properties?
>
> Thanx.
> Lubo
>
> "Nick Kramer [MSFT]" wrote:
>
> > I'm guessing the name xyz can't be found in the context you used it,
> > although it's too late in the day for me to be sure <g>.
> >
> > --
> > -Nick Kramer [MSFT]
> > http://blogs.msdn.com/nickkramer
> >
> > ---
> > This posting is provided "AS IS" with no warranties, and confers no rights.
> > Use of included script samples are subject to the terms specified at
> > http://www.microsoft.com/info/cpyright.htm
> >
> >
> > <lubomir@gmail.com> wrote in message
> > news:1137172194.967723.110270@o13g2000cwo.googlegroups.com...
> > > Basicaly I have an user control that defines a string DependenyProperty
> > > Caption. In the xaml i have the following code:
> > >
> > > <UserControl x:Class="PlasmaBox.TrackHeaderView"
> > > xmlns="http://schemas.microsoft.com/winfx/avalon/2005"
> > > xmlns:x="http://schemas.microsoft.com/winfx/xaml/2005"
> > > Name="xyz"
> > > >
> > > <UserControl.FixedTemplate>
> > > <Grid>
> > > <Grid.ColumnDefinitions>
> > > <ColumnDefinition Width="*"/>
> > > <ColumnDefinition Width="50"/>
> > > </Grid.ColumnDefinitions>
> > > <Grid.RowDefinitions>
> > > <RowDefinition/>
> > > <RowDefinition/>
> > > </Grid.RowDefinitions>
> > >
> > > <Button Grid.Column="1" Grid.Row="0"/>
> > > <Button Grid.Column="1" Grid.Row="1"/>
> > > <TextBlock
> > > Grid.Column="0"
> > > Grid.RowSpan="2"
> > > VerticalAlignment="Center"
> > > Text="{Binding ElementName=xyz,Path=Caption}"/>
> > > </Grid>
> > > </UserControl.FixedTemplate>
> > > </UserControl>
> > >
> > > The Text comes up empty. I've tried al variations of binding with no
> > > luck at all. Is this broken in the December CTP - (if yes, is there a
> > > workaround), or am I doing something wrong?
> > >
> > > Thanx,
> > > Lubomir
> > >

> >
> >
> >

Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting the window which contains a usercontrol Michael Jackson Avalon 2 06-08-2007 12:04 PM
UserControl inside another UserControl with WYSIWYG jan.bannister@gmail.com Avalon 1 02-07-2007 06:42 AM
How to bind to a usercontrol property from inside this usercontrol Pon Avalon 4 11-13-2006 08:38 AM
UserControl in VB project Eli Avalon 1 06-05-2006 06:25 PM
WPF UserControl in a Forms.UserControl MichaelG Avalon 2 01-10-2006 03:52 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