![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
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.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Bug: objet property not set (sample included) Hello, I switch to beta 2 and found a strange bug with my code customizing the expander template. First here is a code sample to demonstrate the bug (i'll explain it after) : <StackPanel> <StackPanel.Resources> <SolidColorBrush x:Key="SolidBorderBrush" Color="#FFFF0000" /> <Style TargetType="{x:Type Expander}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Expander}"> <ToggleButton> <ToggleButton.Template> <ControlTemplate TargetType="{x:Type ToggleButton}"> <StackPanel Orientation="Horizontal"> <Canvas Width="24" Height="24" Margin="2,2,2,2"> <Ellipse Canvas.Left="1" Canvas.Top="1" Width="22" Height="22" StrokeThickness="1" Stroke="#FFFF0000"/> <Path Canvas.Left="8" Canvas.Top="9" StrokeThickness="1" Stroke="#FF000000" Data="F1 M 0,0L 4,8L 8,0L 4,1 Z"/> </Canvas> <Canvas Width="24" Height="24" Margin="2,2,2,2"> <Ellipse Canvas.Left="1" Canvas.Top="1" Width="22" Height="22" StrokeThickness="1" Stroke="{StaticResource SolidBorderBrush}"/> <Path Canvas.Left="8" Canvas.Top="9" StrokeThickness="1" Stroke="#FF000000" Data="F1 M 0,0L 4,8L 8,0L 4,1 Z"/> </Canvas> </StackPanel> </ControlTemplate> </ToggleButton.Template> </ToggleButton> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style TargetType="{x:Type ToggleButton}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ToggleButton}"> <StackPanel Orientation="Horizontal"> <Canvas Width="24" Height="24" Margin="2,2,2,2"> <Ellipse Canvas.Left="1" Canvas.Top="1" Width="22" Height="22" StrokeThickness="1" Stroke="#FFFF0000"/> <Path Canvas.Left="8" Canvas.Top="9" StrokeThickness="1" Stroke="#FF000000" Data="F1 M 0,0L 4,8L 8,0L 4,1 Z"/> </Canvas> <Canvas Width="24" Height="24" Margin="2,2,2,2"> <Ellipse Canvas.Left="1" Canvas.Top="1" Width="22" Height="22" StrokeThickness="1" Stroke="{StaticResource SolidBorderBrush}"/> <Path Canvas.Left="8" Canvas.Top="9" StrokeThickness="1" Stroke="#FF000000" Data="F1 M 0,0L 4,8L 8,0L 4,1 Z"/> </Canvas> </StackPanel> </ControlTemplate> </Setter.Value> </Setter> </Style> </StackPanel.Resources> <Expander x:Name="myExpander" /> <ToggleButton x:Name="myToggleButton" /> </StackPanel> This sample should display 4 ellipse (2 for the expander and 2 for the togglebutton) with an arrow inside each but if you try it you will find that the second ellipse of the expander doesn't have an arrow. The difference between the 2 shapes is simple : the first ellipse has a "constant" color #FFFF0000 and the second uses a SolidColorBrush with the same color. The togglebutton is there to demonstrate that the but doesn't occure if the template is applied directly on it but occures only if it's applied on a togglebutton inside another template. I looked with the debugger to find why the arrow after the ellipse with a SolidColorBrush doesn't render and i found that its properties are not sets ! You can use those strings in the watch window to see this : expander first path (OK) : ((Path) ((UIElement) this.FindName("myExpander")).GetVisualChild(0).GetVisualChild(0).GetVisualChild(0).GetVisualChild(1)).Data expander second path (KO) : ((Path) ((UIElement) this.FindName("myExpander")).GetVisualChild(0).GetVisualChild(0).GetVisualChild(1).GetVisualChild(1)).Data togglebutton first path (OK) : ((Path) ((UIElement) this.FindName("myToggleButton")).GetVisualChild(0).GetVisualChild(0).GetVisualChild(1)).Data togglebutton second path (OK) : ((Path) ((UIElement) this.FindName("myToggleButton")).GetVisualChild(0).GetVisualChild(1).GetVisualChild(1)).Data So can someone a microsoft can look into this ? Thanks, Guillaume |
My System Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Use my custom TypeDescriptor to obtains default Value on property inXAML Property Editor of Visual Studio 2008 | azerty | Avalon | 0 | 04-14-2008 06:14 AM |
| Verifier les messages sans objet missing object | YbeV | Vista mail | 1 | 10-20-2007 11:08 AM |
| Sample Music | TipTop | Vista music pictures video | 0 | 07-03-2007 12:02 PM |
| Sample Music | Travis King | Vista General | 4 | 06-11-2007 10:31 AM |