WPF 常用代码片段CodeSnippet

CodeSnippet

  • 路由事件

<CodeSnippet Format="1.0.0" xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <Header>
    <Title>路由事件代码段Title>
    <Author>衆尋Author>
    <Shortcut>roueShortcut>
    <Description>生成默认的路由事件Description>
    <SnippetTypes>
      <SnippetType>SurroundsWithSnippetType>
      <SnippetType>ExpansionSnippetType>
    SnippetTypes>
  Header>
  <Snippet>
    <Declarations>
      <Literal>
        <ID>typeID>
        <ToolTip>属性类型ToolTip>
        <Default>EventHandlerDefault>
      Literal>
      <Literal>
        <ID>RoutedEventNameID>
        <ToolTip>属性名ToolTip>
        <Default>MyEventDefault>
      Literal>
    Declarations>
    <Code Language="XML">
      
    Code>
  Snippet>
CodeSnippet>

代码效果

RoutedEventArgs routedEvent = new RoutedEventArgs(OutPutChangedEvent);
            RaiseEvent(routedEvent);

  • Devexpress 通知属性

<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <Title>propdxTitle>
      <Shortcut>propdxShortcut>
      <Description>属性和支持字段的代码片段Description>
      <Author>Microsoft CorporationAuthor>
      <SnippetTypes>
        <SnippetType>ExpansionSnippetType>
      SnippetTypes>
    Header>
    <Snippet>
      <Declarations>
        <Literal>
          <ID>typeID>
          <ToolTip>属性类型ToolTip>
          <Default>intDefault>
        Literal>
        <Literal>
          <ID>propertyID>
          <ToolTip>属性名ToolTip>
          <Default>MyPropertyDefault>
        Literal>
        <Literal>
          <ID>fieldID>
          <ToolTip>支持此属性的变量ToolTip>
          <Default>myVarDefault>
        Literal>
      Declarations>
      <Code Language="csharp">
         $property$);}
		set { SetProperty(() => $property$, value); }
	}
	$end$]]>
      Code>
    Snippet>
  CodeSnippet>
CodeSnippets>

你可能感兴趣的:(WPF技术,c#)