views:

18

answers:

1

I can not bind the EditingCommand to the elementname Bla , how can I fix that?

<StackPanel Orientation="Vertical">
                <ToggleButton Content="bold"  IsChecked="{Binding IsTextBold}"   Command="EditingCommands.ToggleBold"    CommandTarget="{Binding ElementName=Bla}" />
                <DataGrid 
                ScrollViewer.CanContentScroll="False"                  
                CanUserResizeRows="True"
                Height="Auto"
                ItemsSource="{Binding Lessons}"
                AutoGenerateColumns="False" 
                x:Name="DailyGrid" 
                VerticalAlignment="Top"
                SelectionMode="Single"
                CanUserSortColumns="False"
                Background="#FF2DCE2D"
                CanUserAddRows="False" HeadersVisibility="All" RowHeaderWidth="40" RowHeight="200">
                    <DataGrid.Columns>
                        <DataGridTextColumn IsReadOnly="True" Binding="{Binding LessonNumber}" Header="Period" Width="50" />
                        <DataGridTextColumn IsReadOnly="True" Binding="{Binding SchoolclassCode}" Header="Class code" Width="70" />

                        <DataGridTemplateColumn Width="0.5*" Header="Homework">
                            <DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <RichTextBox    SelectionBrush="#FF1E4D7C" UseLayoutRounding="True">
                                        <FlowDocument >
                                            <Paragraph>
                                                <Run  Text="{Binding Homework}"/>
                                            </Paragraph>
                                        </FlowDocument>
                                    </RichTextBox>
                                </DataTemplate>
                            </DataGridTemplateColumn.CellTemplate>
</DataGrid>
</StackPanel>
A: 

@To the IDIOT who marked my last 3 wpf questions with a minus point

stuck your arrogance in your ass til it pops out your mouth.

Having found this link I was again right in saying most wpf controls are buggy as hell and programmed like shit.

Read that link and learn: http://blogs.msdn.com/b/jaimer/archive/2008/11/22/forwarding-the-datagrid-s-datacontext-to-its-columns.aspx

msfanboy