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

  • Home
  • SEARCH
  • 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 9247079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:38:37+00:00 2026-06-18T09:38:37+00:00

hi normally it should work automatically but it doesn’t XAML: <DataGrid AutoGenerateColumns=False Width=350 IsReadOnly=True

  • 0

hi normally it should work automatically but it doesn’t

XAML:

 <DataGrid AutoGenerateColumns="False" Width="350" IsReadOnly="True" 
                              ItemsSource="{Binding StichwortList}" >
           <DataGrid.Columns>
                <DataGridTextColumn Binding="{Binding DisplayName}" Width="350">
                      <DataGridTextColumn.Header>
                            <DockPanel Margin="0" Width="340" HorizontalAlignment="Stretch" LastChildFill="True">
                                  <TextBlock DockPanel.Dock="Left" Margin="0" Text="Name"/>
                                  <Button DockPanel.Dock="Right" Content="-" Margin="0" Width="23" Command="{Binding RemoveStichwortCommand}"/>
                                  <Button DockPanel.Dock="Right" Content="+" Margin="0" Width="23" Command="{Binding AddStichwortCommand}"/>
                                  <Label />
                            </DockPanel>
                      </DataGridTextColumn.Header>
                 </DataGridTextColumn>
           </DataGrid.Columns>
  </DataGrid>

relevant Code:

        private RelayCommand _addStichwortCommand;
        public ICommand AddStichwortCommand
        {
            get { return _addStichwortCommand ?? (_addStichwortCommand = new RelayCommand(param => this.OnAddStichwort())); }
        }

        private void OnAddStichwort()
        {
            // some code
        }

        private RelayCommand _removeStichwortCommand;
        public ICommand RemoveStichwortCommand
        {
            get { return _removeStichwortCommand ?? (_removeStichwortCommand = new RelayCommand(param => this.OnRemoveStichwort())); }
        }
private void OnRemoveStichwort()
        {
           // some code
        }

my other bindings to this view works and my Command Binding also works fine normally

so could please anyone tell me whats wrong with my binding?

Edit

ohh i forgot

it is all in a Usercontrol whose Datacontext contains al the Propertys andfor the Bindings and Commands

Soultion:

the DockPanel need to Bind his Datacontext to the Usercontrol Datacontext and the Usercontrol needs a name

x:Name="uc"

<DockPanel Margin="0" Width="340" HorizontalAlignment="Stretch" LastChildFill="True" DataContext="{Binding ElementName=uc, Path=DataContext}">
     <TextBlock DockPanel.Dock="Left" Margin="0" Text="Name"/>
     <Button DockPanel.Dock="Right" Content="-" Margin="0" Width="23" Command="{Binding RemoveStichwortCommand}"/>
      <Button DockPanel.Dock="Right" Content="+" Margin="0" Width="23" Command="{Binding AddStichwortCommand}"/>
      <Label />
</DockPanel>

if the solution above doesn’t work you should take a look on this answer

  • 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-06-18T09:38:38+00:00Added an answer on June 18, 2026 at 9:38 am

    You have to name your UserControl in XAML and use it in binding. Something like following code:

    <UserControl x:Name="uc" >
    .
    .
    .
    <Button DockPanel.Dock="Right" Content="-" Margin="0" Width="23" Command="{Binding RemoveStichwortCommand, ElementName=uc}"/>
    <Button DockPanel.Dock="Right" Content="+" Margin="0" Width="23" Command="{Binding AddStichwortCommand, ElementName=uc}"/>
    

    Hope this help.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

May I am wrong, but i think this codei posted below should work. Any
I need to issue the telnet close command and normally, ^] (Ctrl-]) should work.(can't
I have a query (a view actually) the normally should define a unique mapping
Normally, type checking is frowned upon in Python and for good reason-- you should
Example: if($('#' + untrusted_js_code).length) > 0 ....` Normally untrusted_js_code should be a simple string
First off, my excuse for posting here, normally I feel I should be able
This is probably simple but I do not seem to get it to work.
I have a real big problem that normally doesn't happen. For some reason on
Normally UTF should be uppercased as it's an abbreviation. However, attributes in HTML are
I'm having a problem getting mouse wheel scrolling to work in the following XAML,

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.