Click here to Skip to main content
15,899,754 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hello everybody

I'm Novice in wpf and I'm try to use a ListBox whith elements in left hand and have a container in right hand to show custom UserControl, when I click an Item form ListBox to show related UserControl in right hand.

Is there a good way to do this?
I try to use windows Resource and then add this resource to group box with this code:

XML
<pre lang="xml"><Window.Resources>
        <Border x:Key="FileProperties">
            <StackPanel>
                <StackPanel Orientation="Horizontal">
                    <RadioButton Margin="5" GroupName="File">File Name</RadioButton>
                    <TextBox x:Name="txtFilePath" Text="{Binding Value}" Width="180" Margin="5"/>
                    <Button x:Name="btnBrowse" Margin="5" Template="{DynamicResource GlassButton}" Click="btnBrowse_Click">Browse</Button>
                </StackPanel>
                <StackPanel Orientation="Horizontal">
                    <RadioButton Margin="5" GroupName="File">Select Variable</RadioButton>
                    <ComboBox Margin="5"></ComboBox>
                </StackPanel>
            </StackPanel>
        </Border>

XML
</Windows.Resource>



XML
GroupBoxProperties.Content = this.TryFindResource("the Resource name");

But I have problem too,
My problem was that I can't access elements in Resource, thus I try to use UserControl Instead of Resource.

Is there good way to do it?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900