XAML Code============= <Style TargetType="{x:Type igDP:CellValuePresenter}" x:Key="_visiblerHeaderRowFieldLeft" BasedOn="{StaticResource _visiblerHeaderRowField}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}"> <Grid Background="{TemplateBinding Background}"> <StackPanel Orientation="Vertical"> <igEditors:XamNumericEditor Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Value}" /> <TextBox Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Value}" /> </StackPanel> <!--<ContentPresenter HorizontalAlignment="Left" VerticalAlignment="Center" />--> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style>
unboundField.
Settings.CellValuePresenterStyle = (Style)this.Resources["_visiblerHeaderRowFieldLeft"];
I tried to show XamCurrencyEditor in Cell of XamDataGrid but it dosnt show the value (not the same binding is applied to text block which shows the value, so no binding issue).
Code Behind============ Style style = new Style(typeof(XamCurrencyEditor)); unboundField.Settings.EditAsType = typeof (double); unboundField.Settings.EditorStyle = style;
I tried with code behind but its not working? Please help me in this.
Thanks... I am done
Hi anant_9sept,
Let me know if you have any questions on this.
The reason the value doesn't show is because you are using an UnboundField. UnboundFields are not bound to anything so the cell's value property is going to be null. What you should do is apply a converter to your UnboundField that sets the cell's value based on some criteria. You then should apply a converter to the XamNumericEditor/XamCurrencyEditor to make sure the proper values are being passed to it. For instance, if the editor recieves a string it will try to parse it to a number but if the string contains only letters a first chance exception may be thrown. You'll need to handle this appropriately.
Without knowing your exact implementation I've put together a simple sample to demonstrate this.
I'm gonna put together a sample to test this and I'll update you on my progress by end of day tomorrow.