We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Accessing Control Inside ContentTemplate

Thread ID:

Created:

Updated:

Platform:

Replies:

114318 Nov 12,2013 09:59 PM Mar 6,2018 01:44 PM WinRT 6
loading
Tags: SfAccordion
handre
Asked On November 12, 2013 09:59 PM

Hi,

I am currently using Syncfusion version 11.1.0.21, and am trying to access control inside SfAccordion.ContentTemplate. My code looks like this:

<syncfusion:SfAccordion ItemsSource="{Binding Items}" DisplayMemberPath="Name" SelectionMode="ZeroOrOne">
                <syncfusion:SfAccordion.ContentTemplate>
                    <DataTemplate>
                        <Border>
                            <Grid>
                                <playerframework:MediaPlayer x:Name="targetPlayer" Source="{Binding SomeUrl}" />
                                <Border>
                                    <Button x:Name="targetButton"/>
                                </Border>
                            </Grid>
                        </Border>
                    </DataTemplate>
            </syncfusion:SfAccordion.ContentTemplate>
</syncfusion:SfAccordion>

Please provide solution on how to:
  1. get "targetPlayer" and "targetButton" in my code behind? (I want to play the video programmatically, for example)
  2. make the entire controls in SfAccordion.SelectedItem disabled and enabled when its "targetButton" is clicked (the button itself is not affected, of course)
  3. Stop the player when SelectionChanged occured and on the previous SelectedItem, "targetPlayer" is playing a media.
Any simple C# and XAML codes or  samples are appreciated. 

Thanks in advance!

Regards,
Handre

Suresh B [Syncfusion]
Replied On November 13, 2013 07:31 AM

Hi Handre,

Thanks for using Syncfusion products.

We have created a simple sample to achieve your requirement and you can find the sample under the following location:

In the sample, we have created a accordion to in that ContentTemplate  we have  button and mediaplayer control . By default the player isenabled is false, when user click the button then player is enabled, Also in Selectionchanged event the previous player has been stopped.

Please let us know in case of any other queries,

Thanks and Regards,
Suresh B


Suresh B [Syncfusion]
Replied On November 13, 2013 07:31 AM

Hi Handre,

Thanks for using Syncfusion products.

We have created a simple sample to achieve your requirement and you can find the sample under the following location:

In the sample, we have created a accordion to in that ContentTemplate  we have  button and mediaplayer control . By default the player isenabled is false, when user click the button then player is enabled, Also in Selectionchanged event the previous player has been stopped.

Please let us know in case of any other queries,

Thanks and Regards,
Suresh B


handre
Replied On November 17, 2013 11:21 PM

Hi Suresh,

Thanks a lot for the sample. I actually have to rewrite the code in your samples into new sample project because the sample won't run. Well in the end, it runs beautifully and that's all that matters.

So basically, user select an accordion item then select a button, and the sample does this:
            Grid grid = GetParentItem(sender as DependencyObject) as Grid;
            IEnumerable<MediaPlayer> textBoxes = FindVisualChildren<MediaPlayer>(grid)
to get list of control (MediaPlayer). In my case, I want to do certain things (say, to enable a MediaPlayer or to change text of a TextBox) in a selected accordion item right when user selects an accordion item. In the accordion SelectionChanged event handler, I've tried few things and none have worked so far.
Could you do something about it?

Oh, we're of interested in accordion and basic charts lately. I wonder if you could provide one sample of simple basic line chart hosted inside accordion item (like, we have 3 or 4 accordion item where on each item we put a basic line chart with 1 or 2 series of data). That would be awesome.

Thank you,
Handre

Vignesh V [Syncfusion]
Replied On November 20, 2013 09:23 PM

Hi Hadre,

Query1: Enabling media player when user selects an SfAccordionItem

We have attached a sample in which we have taken the media player and enabled it during selectionchanged.

Sample Link: AccordianSample1.zip


Query2: Basic charts in AccordionItem

Please find the sample for adding chart in SfAccordionItem.



Please let us know if you need further assistance.

Regards,
Vignesh V

hassan salman
Replied On March 1, 2018 10:44 AM

hi, the download link for the examples does not work.

Durga Rajan [Syncfusion]
Replied On March 6, 2018 01:44 PM

Hi Handre, 

We regret to inform that the provided sample links are broken. Now, we have created new samples in UWP based on your requirement. Since Syncfusion no longer working further improvements for WinRT products, we suggest you to use UWP. UWP is a part of Windows 10 and Windows 10 Mobile. We have all the controls in UWP that are available in WinRT.  Please refer to the below link for more information on this, 
  


In this sample we have play the Video when the “Play” button is clicked and stopped the playing video which is in last selected item. Please download the sample for the same from below location, 
  

 Also we have prepared sample on hosting Chart control inside the Accordion Item. Please download the sample for the sample, 


Please get back to us with more details if the above sample doesn’t meet your requirement.  

Regards, 
Durga S. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;