How to reuse my customize DataGridTemplateColumn

Apr 20, 2009 at 10:54 AM
Hi, I have one DataGridTemplateColumn as below, and it will be reused in several my datagrids, so I would like to make it can be easy to resued. 

Since in the DataTemplate, there's one click event in just one button, so it's hard to put it to ResourceDictionary as one DataTemplate. 

So I try to put it in a user control, but it reported cannot be added to a collection or dictionary of type 'ObservableCollection`1' when I try to use it from a UserControl. I don't understand the reason.
Anyone has better idea how to reuse it? Thanks very much

                <dg:DataGridTemplateColumn Header="Output"  Width="180">
                            <TextBlock Name="txtOutput" Text="{Binding Path=OutputFile, UpdateSourceTrigger=PropertyChanged}"/>
                                <DataTrigger Binding="{Binding Path=IsFileInGroup}" Value="TRUE">
                                    <Setter Property="Visibility" TargetName="txtOutput" Value="Hidden"/>
                            <DockPanel Name="panelOutput" HorizontalAlignment="Stretch">
                                <Button Content="..." Width="30" DockPanel.Dock="Right" Click="btnSelectOutputPath"/>
                                <TextBox HorizontalContentAlignment="Stretch">
                                        <Binding Path="OutputFile" UpdateSourceTrigger="PropertyChanged">
                                <DataTrigger Binding="{Binding Path=IsFileInGroup}" Value="TRUE">
                                    <Setter Property="Visibility" TargetName="panelOutput" Value="Hidden"/>
Jun 1, 2009 at 12:17 PM


me 2 hanging on same kind of scenario.

Have you got any idea for it.


Prabakaran S.