ContainerBindingCollection Not Working WPF

4 posts, 0 answers
  1. senthil
    senthil avatar
    5 posts
    Member since:
    Feb 2011

    Posted 10 Feb 2011 Link to this post

    Hi

    Iam using RadTreeview Custom Control  Then Cosuming the Control  There is one button

    When button is Clicked Create one node With Check box   but Check box Came but not Selected


    This is our Consume Page Xaml

    <local

     

     

    :TreeView x:Name="RadTreeView1" ToolTip="Enter Name" Height="500" Width="300"

     

     

     

    ItemsOptionListType="CheckList" IsOptionElementsEnabled="True" >

     

     

     

     

     

    </local:TreeView>

     


    Then Click Event

     

     

    private void AddItem_Click(object sender, RoutedEventArgs e)

     

    {

     

     

    List<TreeImageCollection> lstTreeImageCollection1 = new List<TreeImageCollection>();

     

     

     

    TreeImageCollection objTreeImageCollection = new TreeImageCollection();

     

    objTreeImageCollection.ImageID =

     

    "200";

     

    objTreeImageCollection.ImageSource =

     

    "../Images/iDropdownArrowDownHOT.png";

     

    objTreeImageCollection.ToolTip =

     

    "Hi This my Image ";

     

     

     

    //objTreeImageCollection.Alignment = ImageAlignment.Left;

     

    lstTreeImageCollection1.Add(objTreeImageCollection);

    RadTreeView1.AddNode(

     

    "0", "4", "Item ggg004", null, lstTreeImageCollection1, ToggleState.On, false, false, false);

     

    }





    Regards
    SenthilNathan.S
  2. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 10 Feb 2011 Link to this post

    Hello senthil,

    From the code snippet you sent I am not sure how exactly you defined your RadTreeView and what the AddNode() method do.

    However if the RadTreeView is databound, basically you can bind the CheckState property of the RadTreeViewItem using a StyleBinding, like explained here.

    Give this a try and let us know if it works for you. If not, it would be best to send us a sample project reproducing your issue and we will look further into it.

    All the best,
    Tina Stancheva
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
  3. UI for WPF is Visual Studio 2017 Ready
  4. senthil
    senthil avatar
    5 posts
    Member since:
    Feb 2011

    Posted 11 Feb 2011 Link to this post

    Hi Tina

    that is notworking


    I Have a TreeView Custom Control

    Example  Treeview.Xaml Contains

    <

     

     

    Style x:Key="RadTreeViewItemStyle" TargetType="local:TreeViewItem">

     

     

     

     

    <Setter Property="HorizontalContentAlignment" Value="Left" />

     

     

     

     

    <Setter Property="VerticalContentAlignment" Value="Center" />

     

     

     

     

    <Setter Property="CheckState" Value="Off" />

     

     

     

     

     

     

    </Style>

     

     

    <

     

     

    Style TargetType="local:iTreeView">

     

     

     

     

     

     

    <Setter Property="ItemContainerStyle" Value="{StaticResource RadTreeViewItemStyle}" />

    </Style>

    in Class File

    public clsss Treeview : RadTreeView
    {

    }

    Consume Application look like this

     

     

    <local:

     

     

    TreeView x:Name="RadTreeView1" ToolTip="Enter Name" Height="500" Width="300"

     

     

     

     

     

    ItemsOptionListType="CheckList" IsOptionElementsEnabled="True" >

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    </local:TreeView>

     

  5. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 16 Feb 2011 Link to this post

    Hello senthil,

    The code you provided seems to be insufficient in order for us to get close to your scenario. However, I'll shoot in the dark and try to advice you. First, the RadTreeView must be bound to ObservableCollection<> since it inherits from INotifyCollectionChanged and INotifyPropertyChanged and this way changes in the ViewModel collection (bound object`s collection) will reflect the RadTreeViewItems. On the other hand, the property in your ViewModel that will be bound to the ToggleState of the RadTreeViewItem should also implement the INotifyPropertyChanged interface. Finally, any runnable sample showing the issue will be highly appreciated and you we could advice you much faster. Thank you for your cooperation.

    Kind regards,
    Petar Mladenov
    the Telerik team
Back to Top