Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3959334
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T02:43:03+00:00 2026-05-20T02:43:03+00:00

<ItemsControl DockPanel.Dock=Top ItemsSource={Binding Path={x:Static vmc:clsPersonViewModel.ChildrenPath}, Mode=OneWay}> <ItemsControl.ItemTemplate> <DataTemplate DataType={x:Type vmc:clsPersonViewModel}> <TextBlock Text={Binding Path={x:Static vmc:clsPersonViewModel.TrimPath}}

  • 0
<ItemsControl DockPanel.Dock="Top" ItemsSource="{Binding Path={x:Static vmc:clsPersonViewModel.ChildrenPath}, Mode=OneWay}">
   <ItemsControl.ItemTemplate>
      <DataTemplate DataType="{x:Type vmc:clsPersonViewModel}">
         <TextBlock    Text="{Binding Path={x:Static vmc:clsPersonViewModel.TrimPath}}"
                  Height="20"
                  Margin="2">
         </TextBlock>
      </DataTemplate>
   </ItemsControl.ItemTemplate>
</ItemsControl>

In the code above, if there are no children (the ChildrenPath property returns NULL), nothing is rendered in the view. In the code below, when ChildrenDataSetPath is NULL the XamDataGrid still gets rendered. How do I achieve the same for a single object (as opposed to a collection) as the datacontext?

<DataTemplate DataType="{x:Type vmb:clsPersonViewModel}">
   <igDP:XamDataGrid DataSource="{Binding Path={x:Static vmb:clsPersonViewModel.ChildrenDataSetPath}}">
   </igDP:XamDataGrid>
</DataTemplate>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T02:43:04+00:00Added an answer on May 20, 2026 at 2:43 am

    I finally achieved this by using ContentControl. I mapped my DataContext to Content property of ContentControl and then added Datat Template for the view in resources. When the datacontext is not of type clsPersonViewModel, it does not show the ucPersonView.

    <ContentControl Content="{Binding ElementName=_RightSidePanel, Path=DataContext}" >
    <ContentControl.Resources>
        <DataTemplate DataType="{x:Type vmb:clsPersonViewModel}">
            <igDP:ucPersonView />               
        </DataTemplate>
    </ContentControl.Resources>
    </ContentControl>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Window1.xaml I have menu and display area: <Menu x:Name=TheMenu Width=Auto Height=25 DockPanel.Dock=Top/> <ItemsControl
This correctly wraps the TextBlocks horizontally: <StackPanel DockPanel.Dock=Top Margin=10 HorizontalAlignment=Left> <TextBlock Text=Simple WrapPanel: Margin=0
I have a DockPanel set up in the DataTemplate of an ItemsControl as below:
I have an ItemsControl whose ItemsSource gets bound to an ObservableCollection<Component> at run time.
I have a list of States in an ItemsControl, the DataTemplate is a CheckBox.
I have an <ItemsControl> with a custom <DataTemplate> (and also a custom <ItemsPanelTemplate> that
I'm binding an ItemsControl to an EntitySet in a WPF application. Its not acting
I have the following XAML: <DockPanel x:Name=OverViewContainer AllowDrop=True> <StackPanel Orientation=Horizontal DockPanel.Dock=Bottom HorizontalAlignment=Right> <uicommon:Toolbar DataContext={Binding
I have a dockpanel that I dynamically fill using an ItemsControl to populate the
I have an ItemsControl with a DataTemplate that is bound to an ObservableCollection of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.