title: How to set canvas ZIndex WPF button control in Click Event?
body: <p>I have three buttons lying one by one. I want to show top of all button, which i click. So that I have set canvas ZIndex in XAML Code. But I want to do this in Code Behind. </p>
  
  <p>My XAML Output &amp; Code - </p>
  
  <p><img src="https://i.stack.imgur.com/hFLGK.jpg" alt="image"></p>
  
  <pre><code>&lt;Button Name="Button1" Canvas.ZIndex="3" Content="Button1" Canvas.Top="100" Width="163" Height="58" FontSize="26" Click="Button1_Click" /&gt;
  &lt;Button Name="Button2" Canvas.ZIndex="2" Content="Button1" Canvas.Top="100" Canvas.Left="130" Width="163" Height="58" FontSize="26" Click="Button2_Click" /&gt;
  &lt;Button Name="Button3" Canvas.ZIndex="1" Content="Button1" Canvas.Top="100" Canvas.Left="260" Width="163" Height="58" FontSize="26" Click="Button3_Click" /&gt;
  </code></pre>
  
  <p>My XAML Output &amp; Code (Check How the ZIndex was Changed)- </p>
  
  <p><img src="https://i.stack.imgur.com/5gs7s.jpg" alt="image"></p>
  
  <pre><code>&lt;Button Name="Button1" Canvas.ZIndex="3" Content="Button1" Canvas.Top="100" Width="163" Height="58" FontSize="26" Click="Button1_Click" /&gt;
  &lt;Button Name="Button2" Canvas.ZIndex="2" Content="Button1" Canvas.Top="100" Canvas.Left="130" Width="163" Height="58" FontSize="26" Click="Button2_Click" /&gt;
  &lt;Button Name="Button3" Canvas.ZIndex="1" Content="Button1" Canvas.Top="100" Canvas.Left="260" Width="163" Height="58" FontSize="26" Click="Button3_Click" /&gt;
  </code></pre>
  
  <p>How I change the Canvas.ZIndex property in WPF button control in Click Event?</p>