Skip to content

Instantly share code, notes, and snippets.

@tmyt
Created June 21, 2014 09:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmyt/afb326b0135ba8c08b64 to your computer and use it in GitHub Desktop.
Save tmyt/afb326b0135ba8c08b64 to your computer and use it in GitHub Desktop.
いまにゅーにお昼きかれたやつ、こうすればいいんじゃないん、って思ったやつ(その1)
<StackPanel>
<local:myControl MyButtonClick="MyButtonClick" />
<Grid x:Name="HogeGrid" Visibility="Collapsed" />
</StackPanel>
public class MainPage : Page
{
public MainPage()
{
InitializeComponents();
}
public void MyButtonClick(object sender)
{
HogeGrid.Visibility = Visibility.Visible;
}
}
<Button Content="ぼたん" Click="ButtonClick" />
public class myControl : UserControl
{
public event EventHandler MyButtonClick;
public myControl(){
InitializeComponents();
}
public void ButtonClick(object sender, RoutedEventArgs args)
{
var h = MyButtonClick;
if(h!=null) h(this);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment