Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

WPF Databinding usercontrols

$
0
0
some one please help me.
i have a tree control

    <UserControl x:Class="MyApp.Views.MyTree"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
                 mc:Ignorable="d" 
                 d:DesignHeight="300" d:DesignWidth="300">
        <Grid >
            <TreeView Name="myTreeControl" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="#FFB1D1DA" />
        </Grid>
    </UserControl>
And a grid control

    <UserControl x:Class="MyApp.Views.MyOrder"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
                 mc:Ignorable="d" 
                d:DesignHeight="300" d:DesignWidth="300">
        <Grid>
            <DataGrid Name="myGridControl" HorizontalAlignment="Stretch"  VerticalAlignment="Stretch" Background="#FFF7E5E5" />
        </Grid>
    </UserControl>

I want to put this to some other control 

    <UserControl x:Class="MyApp.Views.ContainerPanel"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
                 xmlns:Views="clr-namespace:MyApp.Views"
                 mc:Ignorable="d" 
                 d:DesignHeight="300" d:DesignWidth="300">
        
        
        <Grid Name="grdContainer" >
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" ></RowDefinition>
                <RowDefinition Height="*"></RowDefinition>
                <RowDefinition Height="Auto"></RowDefinition>
                <RowDefinition Height="*" ></RowDefinition>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"></ColumnDefinition>
                <ColumnDefinition Width="Auto"></ColumnDefinition>
                <ColumnDefinition Width="Auto"></ColumnDefinition>
                <ColumnDefinition Width="Auto"></ColumnDefinition>
            </Grid.ColumnDefinitions>
    
            <Button Name="btnS" Content="S"  Width="25" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Right" Height="25" Click="btnS_Click" />
            <Button Name="btnF" Content="F" Width="25"  Grid.Row="0" Grid.Column="2" Height="25" Click="btnF_Click"/>
            <Button Name="btnP" Content="P" Width="25" Height="25" Grid.Row="0" Grid.Column="3" Click="btnP_Click" />
    
            <Views:MyTree  x:Name="FT" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Row="1" Grid.ColumnSpan="4"  />
            
            <GridSplitter Name="GS" HorizontalAlignment="Stretch" Grid.Row="2" VerticalAlignment="Stretch" Height="9" ResizeBehavior="PreviousAndNext" Background="#FFC1B6B6" Grid.ColumnSpan="4" />
    
            <Views:MyOrder  x:Name="PO" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Row="3" Grid.ColumnSpan="4"  />   
    
    
    
        </Grid>
    </UserControl>

On the button clicks it hide or show or split the screens.
And now I have a main panel. And that hae a tab control. Tab control's itesm shuld be added dynamically. And each tab item is ConatainerPanel. And standing at MainPanel I have to add or remove items to MyTree and MyGrid..
I would like to  use Property PropertyChangedEventHandler for doing these..
Can any one help  me in this?
Can any one give some sample codes?

Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>