OSDN Git Service

ReplaceAllを追加した
authorgdkhd812 <jbh03215@hotmail.com>
Wed, 28 Aug 2013 23:40:41 +0000 (08:40 +0900)
committergdkhd812 <jbh03215@hotmail.com>
Wed, 28 Aug 2013 23:40:41 +0000 (08:40 +0900)
WPF/Test/MainWindow.xaml
WPF/Test/MainWindow.xaml.cs

index e13ecd4..db3f925 100644 (file)
@@ -7,6 +7,7 @@
         <Grid.RowDefinitions>
             <RowDefinition Height="24"/>
             <RowDefinition/>
+            <RowDefinition Height="24"/>
         </Grid.RowDefinitions>
         <Menu Grid.Row="0">
             <MenuItem Header="Test">
             </MenuItem>
         </Menu>
         <MyNamespace:FooTextBox x:Name="fooTextBox" Grid.Row="1"/>
+        <StackPanel Grid.Row="2" Orientation="Horizontal">
+            <TextBlock Text="FindPatter"/>
+            <TextBox Name="FindPattern" Width="100"/>
+            <TextBlock Text="ReplaceAll"/>
+            <TextBox Name="ReplacePattern" Width="100"/>
+            <Button Name="ReplaceAll" Content="ReplaceAll" Click="ReplaceAll_Click"/>
+        </StackPanel>
     </Grid>
 </Window>
index 5ed1212..6d90398 100644 (file)
@@ -195,5 +195,13 @@ namespace Test
                 MessageBox.Show("complete");
             }
         }
+
+        private void ReplaceAll_Click(object sender, RoutedEventArgs e)
+        {
+            this.fooTextBox.Document.SetFindParam(this.FindPattern.Text, false, System.Text.RegularExpressions.RegexOptions.None);
+            this.fooTextBox.Document.ReplaceAll(this.ReplacePattern.Text, false);
+            this.fooTextBox.Refresh();
+            MessageBox.Show("complete");
+        }
     }
 }