Container with Template Selector and Edit Template Selector

1 Answer 102 Views
EntityFrameworkCoreDataSource (.Net Core)
Romain
Top achievements
Rank 2
Iron
Iron
Romain asked on 15 Sep 2022, 06:40 PM | edited on 15 Sep 2022, 06:41 PM

Hi,

I'm trying to identify the best approach / best control that I could bind its "value" to a property that may change type during runtime.

For instance it could look like:  Value = [ ... ],  where [ ... ]  would be the value of a boolean, string or decimal.

Simple code could be:

<StackPanel Orientation="Horizontal">
                            <TextBlock Text="Value ="/>
                            <!--< Control something ??? Value={Binding ActiveItem, Mode=TwoWay} />-->

                        </StackPanel>

I guess some type of generic control where I  can set a Template Selector. But in addition I would be great if I could set an EditTemplateSelector as well,  so I can use a different control for editing

GridViewCell has this kind of behavior but I would need it out of a RadGridView

Thank you for your help and ideas.

1 Answer, 1 is accepted

Sort by
0
Stenly
Telerik team
answered on 20 Sep 2022, 03:58 PM

Hello Romain,

We currently do not provide such control, however, I found an interesting StackOverflow article that shows a result similar to the desired one. The suggested approach utilizes the native WPF ContentControl element together with a custom style and triggers.

The article can be found at the following link:

.net - Dynamically display a control depending on bound property using WPF - Stack Overflow

I hope the provided information will be of help to you.

Regards,
Stenly
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
EntityFrameworkCoreDataSource (.Net Core)
Asked by
Romain
Top achievements
Rank 2
Iron
Iron
Answers by
Stenly
Telerik team
Share this question
or