0

I have two usercontrols : ParentUserControl.xaml and ChildUserControl.xaml

ParentUserControl:

<UserControl x:Class="DemoSilverlight.ParentUserControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Local="clr-namespace:DemoSilverlight"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
            Loaded="UserControl_Loaded">

    <Grid x:Name="LayoutRoot" Background="White">
        <sdk:TabControl x:Name="tabControlHeatMapEditor" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" SelectionChanged="tabControlHeatMapEditor_SelectionChanged" Height="510" FontFamily="Verdana" FontSize="12">
            <sdk:TabItem Header="Original Heat Map" x:Name="tabItemOriginalHeatMap">
                <Local:ChildUserControl x:Name="chartControlOriginal"/>
            </sdk:TabItem>
            <sdk:TabItem Header="Revised Heat Map" x:Name="tabItemRevisedHeatMap">
                <Local:ChildUserControl x:Name="chartControlRevised"/>
            </sdk:TabItem>
            <sdk:TabItem Header="Compare Original/Revised" x:Name="tabItemCompareOrgRev">
                <!--<Local:ChildUserControl x:Name="chartControlCompare"/>-->
            </sdk:TabItem>
        </sdk:TabControl>
    </Grid>
</UserControl>

Inside the ChildUserControl control I have a button control. In the code behind page of the ChildUserControl.xaml.cs, I want to know which instance of the ChildUserControl is used and based on that I want to access the button within the ChildUserControl in order to make it disabled.

Can anyone help me to resolve this problem

Thanks & Regards, Santosh Kumar Patro

4

1 に答える 1

0

ChildUserControl に列挙型があります。TabItem Selection に基づいて enum プロパティを設定し、さらに条件に基づいてボタンを有効または無効にすることができます。

于 2013-03-15T15:37:29.550 に答える