Current filter:
                                You should refresh the page.
                                Support Center
                                0
                                  • Hello,

                                    I am using your LayoutControl in a project. Inside, I add a simple LayoutItem, for which I wish to use a custom LabelTemplate.

                                    For this LabelTemplate I wish to use a custom component which allows editing the text of the component on click.
                                    My problem is how to Two-Way databind the text of this control to that of the LayoutItem's label (so I can retrieve it via .Label later on).

                                    I've tried different variations on {Binding Label, Mode=TwoWay} but with no luck. Simply setting the Text-property of my control to {Binding} allows me to read the Label, but not edit it.

                                    I do not have the experience with Silverlight or Developer Express to debug this myself, thus I turn to you!

                                    Oh, and as an aside: Is there a "nice" way of adding a label after the textbox control in the LayoutItem? It can sometimes be convenient with a brief explanatory text (i.e. mm / cm / kg or such) after a TextBox.

                                    Thanks in advance!

                                    My LayoutControl:

                                    <lc:LayoutControl Height="744" HorizontalAlignment="Left" Margin="258,12,0,0" Name="layoutControl1" VerticalAlignment="Top" Width="754">
                                                <lc:LayoutItem Label="layoutItem2" Name="layoutItem2">
                                                    <lc:LayoutItem.LabelTemplate>
                                                        <DataTemplate>
                                                            <Self:ClickToEditTextBox Text="{Binding}" />
                                                        </DataTemplate>
                                                    </lc:LayoutItem.LabelTemplate>
                                                        <dxe:TextEdit Name="textEdit2" Grid.ColumnSpan="2" Grid.Column="0" Grid.Row="0" />
                                                </lc:LayoutItem>
                                            </lc:LayoutControl>

                                0

                                Hi Søren,

                                It looks as if it is impossible to accomplish this task using a "plain" binding (this seems to be a DataTemplate specificity). The only solution we could find is to use the TwoWay element binding for this purpose. Here is some sample code, illustrating this approach in action:

                                [XAML]
                                <lc:LayoutControl Name="layoutControl1" Orientation="Vertical"> <lc:LayoutItem Label="layoutItem2" Name="layoutItem2"> <lc:LayoutItem.LabelTemplate> <DataTemplate> <TextBox Text="{Binding Label, Mode=TwoWay, ElementName=layoutItem2}"/> </DataTemplate> </lc:LayoutItem.LabelTemplate> <dxe:TextEdit Name="textEdit2"/> </lc:LayoutItem> <TextBox Text="{Binding ElementName=layoutItem2, Path=Label}"/> </lc:LayoutControl>

                                >>>>
                                Oh, and as an aside: Is there a "nice" way of adding a label after the textbox control in the LayoutItem? It can sometimes be convenient with a brief explanatory text (i.e. mm / cm / kg or such) after a TextBox.
                                <<<<
                                Right now, there is no easy way to do this. However, we have already been asked for this functionality, and will consider implementing it in the future. I suggest that you track the following suggestion to stay informed on our progress over this item:

                                ID: S132968, LayoutItem - LabelPosition - Add "Bottom" and "Right"

                                Thanks,
                                Vito

                                0

                                Perfect! That's exactly what I needed, thanks :-)

                                Regarding text after the textbox, consider not just allowing us to move the label, but actually adding another field. For the sake of argument, call it Description.

                                Then you could have (for instance)
                                Your height: [----------] cm

                                Regards,

                                Søren Andersen

                                0

                                Hi Søren,

                                I have registered the corresponding suggestion on your behalf, and we will consider implementing this functionality in the future.

                                ID: S36063, LayoutItem - Make it possible to display an additional label after the item content

                                In the meantime, you can modify the built-in template for the LayoutItem and use, for instance, the Tag property to provide the necessary information. I am attaching a small sample, illustrating this approach in action. I hope you will find it helpful.

                                Thanks,
                                Vito

                                0

                                Hi Søren,

                                I am attaching a slightly modified version of the sample, which better aligns UI elements in the LayoutItem template. Please try this version instead.

                                Thanks,
                                Vito

                                If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, Silverlight, ASP.NET, WinForms, HTML5 or Windows 8, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2014 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners