Link to home
Start Free TrialLog in
Avatar of G Scott
G ScottFlag for United States of America

asked on

Finding UserControl in Window WPF

I have a window that has a wrap panel.  In that wrap panel I have placed some viewboxes.  In each of the viewboxes I have placed a simple usercontrol.  How do I assign properties to my usercontrols?  I just can't figure out how to drill down and get to my usercontrol properties.  Sorry I have no code to give as a starting point as I am clueless.  Here is my xaml for the page, if that helps:

<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:WPF_Custom_Control="clr-namespace:WPF_Custom_Control;assembly=WPF_Custom_Control" x:Class="Window1"
    Title="Window1" Height="1080" Width="1920">
    <Grid>
        <WrapPanel HorizontalAlignment="Left" Height="934" Margin="10,10,0,0" VerticalAlignment="Top" Width="1892">
            <Viewbox Height="100" Width="100" Stretch="Uniform" StretchDirection="Both" Name="vb1">
                <WPF_Custom_Control:UserControl1/>
            </Viewbox>
            <Viewbox Height="100" Width="100" Stretch="Uniform" StretchDirection="Both" Name="vb2">
                <WPF_Custom_Control:UserControl1/>
            </Viewbox>
            <Viewbox Height="100" Width="100" Stretch="Uniform" StretchDirection="Both" Name="vb3">
                <WPF_Custom_Control:UserControl1/>
            </Viewbox>
            <Viewbox Height="100" Width="100" Stretch="Uniform" StretchDirection="Both" Name="vb4">
                <WPF_Custom_Control:UserControl1/>
            </Viewbox>
            <Viewbox Height="100" Width="100" Stretch="Uniform" StretchDirection="Both" Name="vb5">
                <WPF_Custom_Control:UserControl1/>
            </Viewbox>
            <Viewbox Height="100" Width="100" Stretch="Uniform" StretchDirection="Both" Name="vb6">
                <WPF_Custom_Control:UserControl1/>
            </Viewbox>
            <Viewbox Height="100" Width="100" Stretch="Uniform" StretchDirection="Both" Name="vb7">
                <WPF_Custom_Control:UserControl1/>
            </Viewbox>
            <Viewbox Height="100" Width="100" Stretch="Uniform" StretchDirection="Both" Name="vb8">
                <WPF_Custom_Control:UserControl1/>
            </Viewbox>
            <Viewbox Height="100" Width="100" Stretch="Uniform" StretchDirection="Both" Name="vb9">
                <WPF_Custom_Control:UserControl1/>
            </Viewbox>
            <Viewbox Height="100" Width="100" Stretch="Uniform" StretchDirection="Both" Name="vb10">
                <WPF_Custom_Control:UserControl1/>
            </Viewbox>
        </WrapPanel>
        <Button Content="Button" HorizontalAlignment="Left" Margin="116,1003,0,0" VerticalAlignment="Top" Width="75" Click="Button_Click"/>

    </Grid>
</Window>

Open in new window


Thank you for any help on this.
ASKER CERTIFIED SOLUTION
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of G Scott

ASKER

I was thinking this was way more complex.  Thank you so much.
Not a problem, glad to help.