locked
How to access Image Brush placed in Window.Resources through code behind? RRS feed

  • Question

  • Hi,

    I have Window.Resources code as below. I need to change the ImageSource of the ImageBrush through Code behind. Can anyone help here.

     <Window.Resources>
            <ResourceDictionary x:Key="myResourceDictionary">
                <ResourceDictionary.MergedDictionaries>
                    <ResourceDictionary Source="ShirtResource.xaml" />
                </ResourceDictionary.MergedDictionaries>
                <ImageBrush x:Key="my3DShirt"  ImageSource="ShirtER___Flat_05MR1.png" />
            </ResourceDictionary>
        </Window.Resources>

    Thanks,

    Bharat.

    Wednesday, March 7, 2012 9:33 AM

Answers

  • var brush = (Brush)FindResource("my3DShirt");

    Regards,
    Pete

    #PEJL

    • Marked as answer by ykbharat Wednesday, March 7, 2012 9:54 AM
    Wednesday, March 7, 2012 9:45 AM