Hello. There is such a code. How to reach Name ScaleTransform in Transform3DGroup from code?

 <Viewport3D x:Name="Viewport3D_1" Visibility="Visible" Width="769" Height="572"> <Viewport3D.Resources> <ResourceDictionary> <Transform3DGroup x:Key="Transform_Model_Cube"> <ScaleTransform3D x:Name="fcb" CenterX="0" CenterY="0" CenterZ="0" ScaleX="0" ScaleY="1" ScaleZ="1" /> </Transform3DGroup> </ResourceDictionary> </Viewport3D.Resources> </Viewport3D> 

    1 answer 1

    According to the documentation of the directive x: Name :

    As mentioned earlier, you should not use x:Name (or Name ) in situations in which x:Key is also used. WPF ResourceDictionary has a special behavior when defining itself in the XAML namespace, but returns Not Implemented or NULL for the INameScope key APIs as a way to enforce this behavior. If the WPF XAML parser encounters Name or x:Name in a specific XAML ResourceDictionary , the name is not added to any of the XAML name scopes. If you try to find this name from any XAML namespace, the FindName methods FindName not return valid results.

    Simply put, do not use x:Name inside a ResourceDictionary .

    • But how can I be, if I need to access the properties of ScaleTransform3D residing inside Transform3DGroup ResourceDictionary? - Demon