how to embed a usercontrol into xamDataGrid and keep the details of original xamDataGrid?
I write the ControlTemplate but I doubt wether I keep all details (eg. color of active rectangle) of original xamDataGrid,
The problem is when i input a value into MyControl(column 4) in the top row (addnewRow) and change the focus into other cell in this row,
the cell of Number column doesn't been filled with a default value 0 automatically,and when i move the activecell into other row, a new record doesn't been generated.
What can i do to fix this?
When i input some value in Name column(column2 not redfined by ControlTemplate) and change the focus into other cell in this row,
the cell of Number column will be filled a 0 automatically,and when i move the activecell into other row, an new record will be generated.
[source of ControlTemplate]
<Style x:Key="StyleEndDateColumn" TargetType="{x:Type igDP:CellValuePresenter}"><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}"><igWindows:CardPanel Background="{TemplateBinding Background}"><Border BorderThickness="{TemplateBinding Border.BorderThickness}" CornerRadius="{TemplateBinding igDP:CellValuePresenter.CornerRadius}" BorderBrush="{TemplateBinding Border.BorderBrush}" Background="{TemplateBinding Panel.Background}" Name="MainBorder" /><Rectangle Fill="{TemplateBinding igDP:CellValuePresenter.BackgroundActive}" Stroke="{TemplateBinding igDP:CellValuePresenter.BorderActiveBrush}" StrokeThickness="1" Name="Active" Width="Auto" Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Opacity="1" Visibility="Collapsed" SnapsToDevicePixels="True" /><ContentPresenter Visibility="Collapsed" Content="{TemplateBinding ContentControl.Content}" ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}" Style="{TemplateBinding igDP:CellValuePresenter.ForegroundStyle}" Name="PART_EditorSite" Margin="{TemplateBinding Control.Padding}" HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}" /><Controls:MyControl DateFormat="yyyymmdd"DateValue="{Binding DataItem.Day, Mode=TwoWay, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}"IsEmbedded ="True"/></igWindows:CardPanel><ControlTemplate.Triggers><Trigger Property="igDP:CellValuePresenter.IsMouseOverRecord"><Trigger.Value><System:Boolean>True</System:Boolean></Trigger.Value></Trigger><Trigger Property="igDP:CellValuePresenter.IsRecordSelected"><Setter Property="Border.BorderThickness"><Setter.Value><Thickness>0,0,1,0</Thickness></Setter.Value></Setter><Setter Property="FrameworkElement.Margin"><Setter.Value><Thickness>0,0,-1,0</Thickness></Setter.Value></Setter><Setter Property="Control.Padding"><Setter.Value><Thickness>2,0,3,0</Thickness></Setter.Value></Setter><Trigger.Value><System:Boolean>True</System:Boolean></Trigger.Value></Trigger><Trigger Property="igDP:DataItemPresenter.HighlightAsPrimary"><Setter Property="Panel.Background"><Setter.Value><Binding Path="BackgroundPrimary" RelativeSource="{RelativeSource Mode=Self}" /></Setter.Value></Setter><Setter Property="Border.BorderBrush"><Setter.Value><Binding Path="BorderPrimaryBrush" RelativeSource="{RelativeSource Mode=Self}" /></Setter.Value></Setter><Setter Property="FrameworkElement.Style" TargetName="PART_EditorSite"><Setter.Value><Binding Path="ForegroundPrimaryStyle" RelativeSource="{RelativeSource Mode=TemplatedParent}" /></Setter.Value></Setter><Trigger.Value><System:Boolean>True</System:Boolean></Trigger.Value></Trigger><Trigger Property="igDP:CellValuePresenter.IsFieldSelected"><Setter Property="Panel.Background"><Setter.Value><Binding Path="BackgroundFieldSelected" RelativeSource="{RelativeSource Mode=Self}" /></Setter.Value></Setter><Setter Property="Border.BorderBrush"><Setter.Value><Binding Path="BorderFieldSelectedBrush" RelativeSource="{RelativeSource Mode=Self}" /></Setter.Value></Setter><Setter Property="FrameworkElement.Style" TargetName="PART_EditorSite"><Setter.Value><Binding Path="ForegroundFieldSelectedStyle" RelativeSource="{RelativeSource Mode=TemplatedParent}" /></Setter.Value></Setter><Setter Property="igDP:CellValuePresenter.CornerRadius"><Setter.Value><CornerRadius>4,4,4,4</CornerRadius></Setter.Value></Setter><Setter Property="Border.BorderThickness"><Setter.Value><Thickness>1,1,1,1</Thickness></Setter.Value></Setter><Trigger.Value><System:Boolean>True</System:Boolean></Trigger.Value></Trigger><Trigger Property="igDP:CellValuePresenter.IsSelected"><Setter Property="Panel.Background"><Setter.Value><Binding Path="BackgroundSelected" RelativeSource="{RelativeSource Mode=Self}" /></Setter.Value></Setter><Setter Property="Border.BorderBrush"><Setter.Value><Binding Path="BorderSelectedBrush" RelativeSource="{RelativeSource Mode=Self}" /></Setter.Value></Setter><Setter Property="FrameworkElement.Style" TargetName="PART_EditorSite"><Setter.Value><Binding Path="ForegroundSelectedStyle" RelativeSource="{RelativeSource Mode=TemplatedParent}" /></Setter.Value></Setter><Setter Property="igDP:CellValuePresenter.CornerRadius"><Setter.Value><CornerRadius>4,4,4,4</CornerRadius></Setter.Value></Setter><Setter Property="Border.BorderThickness"><Setter.Value><Thickness>1,1,1,1</Thickness></Setter.Value></Setter><Trigger.Value><System:Boolean>True</System:Boolean></Trigger.Value></Trigger><Trigger Property="igDP:CellValuePresenter.IsActive"><Setter Property="FrameworkElement.Style" TargetName="PART_EditorSite"><Setter.Value><Binding Path="ForegroundActiveStyle" RelativeSource="{RelativeSource Mode=TemplatedParent}" /></Setter.Value></Setter><Setter Property="UIElement.Visibility" TargetName="Active"><Setter.Value><x:Static Member="Visibility.Visible" /></Setter.Value></Setter><Trigger.Value><System:Boolean>True</System:Boolean></Trigger.Value></Trigger><MultiTrigger><MultiTrigger.Conditions><Condition Property="UIElement.IsMouseOver"><Condition.Value><System:Boolean>True</System:Boolean></Condition.Value></Condition><Condition Property="igDP:CellValuePresenter.IsSelected"><Condition.Value><System:Boolean>False</System:Boolean></Condition.Value></Condition><Condition Property="igDP:CellValuePresenter.IsFieldSelected"><Condition.Value><System:Boolean>False</System:Boolean></Condition.Value></Condition></MultiTrigger.Conditions><Setter Property="Panel.Background"><Setter.Value><Binding Path="BackgroundHover" RelativeSource="{RelativeSource Mode=Self}" /></Setter.Value></Setter><Setter Property="Border.BorderBrush"><Setter.Value><Binding Path="BorderHoverBrush" RelativeSource="{RelativeSource Mode=Self}" /></Setter.Value></Setter><Setter Property="FrameworkElement.Style" TargetName="PART_EditorSite"><Setter.Value><Binding Path="ForegroundHoverStyle" RelativeSource="{RelativeSource Mode=TemplatedParent}" /></Setter.Value></Setter></MultiTrigger><DataTrigger Binding="{Binding Path=Field.IsFixedStateChanging, RelativeSource={RelativeSource Mode=Self}}" Value="True"><Setter Property="Panel.Background"><Setter.Value><SolidColorBrush>#AA8DBAEB</SolidColorBrush></Setter.Value></Setter><Setter Property="Border.BorderBrush"><Setter.Value><SolidColorBrush>#AA8DBAEB</SolidColorBrush></Setter.Value></Setter></DataTrigger><Trigger Property="igDP:CellValuePresenter.IsDataErrorTemplateActive"><Setter Property="ContentControl.ContentTemplate" TargetName="PART_EditorSite"><Setter.Value><DynamicResource ResourceKey="{x:Static igDP:DataPresenterBase.DataErrorContentTemplateKey}" /></Setter.Value></Setter><Trigger.Value><System:Boolean>True</System:Boolean></Trigger.Value></Trigger></ControlTemplate.Triggers>
</ControlTemplate></Setter.Value></Setter><Setter Property="ForegroundStyle" Value="{DynamicResource {ComponentResourceKey {x:Type igDP:XamDataGrid}, GrayForegroundStyle}}"/><Setter Property="ForegroundActiveStyle" Value="{DynamicResource {ComponentResourceKey {x:Type igDP:XamDataGrid}, GrayForegroundStyle}}"/><Setter Property="ForegroundAlternateStyle" Value="{DynamicResource {ComponentResourceKey {x:Type igDP:XamDataGrid}, GrayForegroundStyle}}"/><Setter Property="IsEnabled" Value="True" /></Style>
Hello,
I am just checking if you require any further assistance on the matter.
I have tested Andrew’s sample application(HostAnyControlAddNewRecord.zip) and when try to add new record it seems that the new record comes with correct values in the cells. Would you please send me an isolated sample application following your scenario in order to investigate your issue.
Looking forward to hearing from you.
I tried second way which is mentioned in follow link
http://ko.infragistics.com/community/forums/t/31391.aspx
ithe result of valueEditor is right, but the result of usercontrol is wrong.
in this case, i can see my usercontrol in cell, but the value i inputed will be lost .
[tried source as follow]
<Style TargetType="{x:Type igEditors:XamTextEditor}" x:Key="EditorStyle"><Setter Property="EditTemplate"><Setter.Value><ControlTemplate TargetType="{x:Type igEditors:XamTextEditor}"><StackPanel><!--<igEditors:XamDateTimeEditor Value="{Binding Path=Value, Mode=TwoWay, RelativeSource={x:Static RelativeSource.TemplatedParent}}"></igEditors:XamDateTimeEditor>--><Controls:Mycontrol DateFormat="yyyymmdd"DateValue="{Binding Path=Value, Mode=TwoWay, RelativeSource={x:Static RelativeSource.TemplatedParent}}" IsEmbedded ="True"/></StackPanel></ControlTemplate></Setter.Value></Setter><Setter Property="Template" Value="{Binding Path=EditTemplate, RelativeSource={RelativeSource Self}}" /></Style>