![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | Cannot retrieve the visualtree from a datatemplate Hi evrybody, I'm trying to set a databinding on a gridview column which have a celltemplate. This celltemplate is retrieved from a ressource defined in the form XAML code. To do that i tried the following in the form codebehind : DataTemplate MyDataTemplate= this.FindResource("MyDataTemplateKey") There, everythings seems normal as MyDataTemplate is not null. But when i cannot walk the MyDataTemplate visualtree cause MyDataTemplate.Visualtree is null. Here is the code of the datatemplate : <DataTemplate x:Key="MyDataTemplateKey"> <StackPanel Orientation="Horizontal" Margin="2"> <TextBlock x:Name="Txtbk_Cpte">xxxxx</TextBlock> <Button Margin="2,0,0,0"> <Image Source="C:\xxxx\xxxx.ico" Height="14"/> </Button> </StackPanel> </DataTemplate> What do I do wrong ? Thanx in advance. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Cannot retrieve the visualtree from a datatemplate Got it. I used loadcontent. "Pon" <pongla.public@laposte.net> wrote in message news:%23fDznmgRHHA.388@TK2MSFTNGP04.phx.gbl... > Hi evrybody, > > I'm trying to set a databinding on a gridview column which have a > celltemplate. > This celltemplate is retrieved from a ressource defined in the form XAML > code. > To do that i tried the following in the form codebehind : > DataTemplate MyDataTemplate= this.FindResource("MyDataTemplateKey") > > There, everythings seems normal as MyDataTemplate is not null. > > But when i cannot walk the MyDataTemplate visualtree cause > MyDataTemplate.Visualtree is null. > > Here is the code of the datatemplate : > > <DataTemplate x:Key="MyDataTemplateKey"> > <StackPanel Orientation="Horizontal" Margin="2"> > <TextBlock x:Name="Txtbk_Cpte">xxxxx</TextBlock> > <Button Margin="2,0,0,0"> > <Image Source="C:\xxxx\xxxx.ico" Height="14"/> > </Button> > </StackPanel> > </DataTemplate> > > What do I do wrong ? > > Thanx in advance. > > > |
My System Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| DataTemplate | .NET General | |||