---
title: "How to set position of MediaElement?"  
description: "How to set position of MediaElement?"  
author: "Anonymous User"  
published: 2014-01-28  
updated: 2014-01-28  
canonical: https://www.mindstick.com/forum/1897/how-to-set-position-of-mediaelement  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# How to set position of MediaElement?

I have this [button](https://www.mindstick.com/articles/63/how-to-add-button-in-datagridview-in-csharp-dot-net):

[private](https://www.mindstick.com/blog/11097/java-access-modifiers-the-public-and-the-private-modifiers) void Answer1_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)

{

MediaElement1.Play();

}

The [problem](https://yourviews.mindstick.com/view/81399/tackling-the-problem-of-unemployment-during-corona-pandemic) is that if I [click](https://www.mindstick.com/articles/12423/social-login-magento-2-one-click-to-register-social) it and then quickly click it again the [sound](https://answers.mindstick.com/qa/35122/who-won-an-oscar-award-recently-for-best-sound-mixing) will just continue to play from the position it was when I pressed it again.

What I want is to make the sound replay from the start 0,0. So I thought I may could do it by maybe setting the sound position to 0,0 in the button in the [previous](https://yourviews.mindstick.com/view/81421/unlock-2-0-is-just-like-previous-corona-lockdowns) line of MediaElement1.Play();.

If you know any better solution is good too.

## Replies

### Reply by Pravesh Singh

Hi Ankita.

Yes, just set the Position property:

MediaElement1.Position = TimeSpan.Zero;

MediaElement1.Play();


---

Original Source: https://www.mindstick.com/forum/1897/how-to-set-position-of-mediaelement

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
