Windows Presentation Foundationããã°ã©ãã³ã°ã®ééã
Windows Presentation Foundationããã°ã©ãã³ã°
- ä½è : Chris Sells,Ian Griffiths,å·è¥¿è£å¹¸
- åºç社/ã¡ã¼ã«ã¼: ãªã¼ã 社
- çºå£²æ¥: 2006/02
- ã¡ãã£ã¢: åè¡æ¬
- ã¯ãªãã¯: 18å
- ãã®ååãå«ãããã° (21件) ãè¦ã
(追è¨) 以ä¸ãæ£èª¤è¡¨ã¨ãã¾ããè¦ã¤ã次第追å ãã¦ããäºå®ã
ãã¦ã³ãã¼ãåºæ¥ããµã³ãã«ã³ã¼ãã«ã¤ãã¦
http://www.sellsbrothers.com/writing/avbook/ãããããã¦ã³ãã¼ãåºæ¥ã¾ããããã®ã¾ã¾ã ã¨æ¥æ¬èªç°å¢ã§åä½ãã¾ããã*.csprojãã¡ã¤ã«ããã
<UICulture>en-US</UICulture>
ã®é¨åãåé¤ããå¿ è¦ãããã¾ãã
第ï¼ç« ã®ãµã³ãã«ã«ã¤ãã¦
ãã®ã¾ã¾ã ã¨NovCtpã§ã³ã³ãã¤ã«åºæ¥ã¾ããã以ä¸ã®ä¿®æ£ãå¿ è¦ã§ãã- ch03\NovCtp\ControlsExamples\MyLib\MyLib.csprojããSystem.Transactions.Indigo.dllã®åç §ãåé¤
- ch03\SepCtp\ControlsExamples\Propertiesãã©ã«ãã丸ãã¨ch03\NovCtp\ControlsExamplesã«ã³ãã¼ãã
â»ã³ãã³ãããã³ãããããµã³ãã«ãåããã¦ãã人åã
ãµã³ãã«ã¯Debug.WriteLineã使ã£ã¦ããã®ã§ããã®ã¾ã¾ã ã¨æ¨æºåºåã«ä½ã表示ããã¾ãããMyApp.xaml.cs
using System; using System.Windows; using System.Data; using System.Xml; using System.Configuration; // Traceã¯ã©ã¹ã®ããã追å using System.Diagnostics; namespace ControlsExamples { /// <summary> /// Interaction logic for MyApp.xaml /// </summary> public partial class MyApp : Application { void AppStartingUp(object sender, StartupEventArgs e) { // Trace.Listenersã«æ¨æºåºåã追å TextWriterTraceListener myWriter = new TextWriterTraceListener(System.Console.Out); Trace.Listeners.Add(myWriter); Window1 mainWindow = new Window1(); mainWindow.Show(); } } }
Trace.Listenersã«ã³ã³ã½ã¼ã«ã追å ã
ControlsExamples.csproj
<OutputType>exe</OutputType>
OutputTypeãwinexeããexeã«å¤æ´ã
ch03\NovCtp\ControlsExamples\Example19.xaml.cs
private void AddRectangleClick(object sender, RoutedEventArgs e) { Rectangle rect = new Rectangle(); SetShapeParams(rect); // inputBox.Selection.Start.InsertTextElement(new BlockUIContainer(rect)); inputBox.Selection.Start.InsertTextElement(new InlineUIContainer(rect)); } private void AddEllipseClick(object sender, RoutedEventArgs e) { Ellipse ellipse = new Ellipse(); SetShapeParams(ellipse); // inputBox.Selection.Start.InsertTextElement(new BlockUIContainer(ellipse)); inputBox.Selection.Start.InsertTextElement(new InlineUIContainer(ellipse)); }
ä¸è¨ã®ããã«æ¸ãæããªãã¨ä¾å¤ãçºçãã¾ãã
P.9 ä¾1-11
ÃStartingUp="AppStartingUp" âStartup="AppStartingUp"
P.10 ä¾1-13
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.CSharp.targets(147,9): error MSB3105: é ç® "C:\Home\Projects\avalon\obj\Debug\MyApp.g.cs" 㯠"Sources" ãã©ã¡ã¼ã¿ã§ 1 度以ä¸æå®ããã¾ãããéè¤ããé ç®ã¯ "Sources" ãã©ã¡ã¼ã¿ã§ã¯ãµãã¼ãããã¦ãã¾ããã
ã¨ããã¨ã©ã¼ãã§ã¾ãã
<Page Include="MyApp.xaml" >
ãã®é¨åãä¸è¦ã§ããæåãåå ãåãããªãã¦WinFXãå ¥ãç´ãã¦ãã¾ãã¾ããã(^^;
P.40ã41
ä¸é¨ã¾ãã¯ä¸é¨ã«ãããã³ã°ããé ç®ã®é«ããDockPanelãã©ã決ããã®ãçåã«æãããç¥ãã¾ããã
ä¸ä¸ã«ãããã³ã°ããã¨ãDockPanelã¯é ç®ã縦æ¹åã«å¼ã伸ã°ãã使ç¨å¯è½ãªé åãæºããã¾ãã
TopãBottomã«ãããã³ã°ããä¾ãªã®ã§å¹ ã横æ¹åã ã¨æãã¾ãã
P.66 表2-3
è¦ç´ ã®åå 説æ AccessKey ã¢ã¯ã»ã©ã¬ã¼ã¿ãã¼ã®ã¹ã¿ã¤ã«é¨åã«ä¸ç·ãå¼ã
AccessKeyã§ã¯ãªããAccessTextã§ããã
P.77
30度ã®å転ãé©ç¨ããå¢çããã¯ã¹ã表示ãã¦ãã¾ãã
30度ã§ã¯ãªã50度ã§ããã
P.89
ãããã°ã®åºåPreviewButtonDownButton
PreviewButtonDownGrid
PreviewButtonDownCanvas
PreviewButtonDownEllipse
ButtonDownEllipse
ButtonDownCanvas
ButtonDownGrid
ButtonDownButton
ã¨ãªã£ã¦ãã¾ãããæå¾ã®ButtonDownButtonã¯çºçãã¾ãããClickã¤ãã³ãã¯çºçãã¾ãã®ã§ããã¿ã³ã³ã³ããã¼ã«ã§ã¯ä½ã¬ãã«ãªã¤ãã³ããæå¶ããã¦ããã¨æããã¾ãã
P.99ã100 ä¾3-9
<Window x:Class="ControlsExamples.Example7" xmlns:m="urn:mylib"
ã¨ãxmlns:m="urn:mylib"ã®é¨åãå ¥ãã¦ãããªãã¨ãåããé£ãã¨æãã¾ãã
P.100 ã³ãã³ãã®æå¹å
ã¡ãã¥ã¼ã¢ã¤ãã ãå¼ã³åºãã¨QueryEnabledã¤ãã³ããçºçããã³ãã³ããç¡å¹åããã¦ããå ´åã¯ã³ãã³ãã®å®è¡ãåé¿ããã¾ãã
åé¿ããã¾ãããå°ãªãã¨ãTextBoxã®Copyã³ãã³ãã¯é§ç®ã§ããã
P.106
à AcceptReturnãTrueã«
â AcceptsReturnãTrueã«
P.111ãP.112
à AccessKey
â AccessText
P.134 å³4-9
ï¼ã¤ç®ã®TextBoxã®Binding Pathã¯Nameã§ã¯ãªãAgeã§ãããP.138 ä¾4-17
// æ°ãã¤ãã¦ï¼25ããã¯ä¸ãåã§ã...
ã½ã¼ã¹ã³ã¼ãããããã¨ããæ°ãã¤ãã¦ï¼25ãè¶ããã¨ä¸ãåã§ã...ããªæ°ããã¾ããã©ã¼ã§ããã話ã§ããã(^^;
P.140ã141 ä¾4-20
Peopleãªãã¸ã§ã¯ãã®ä¾ãªã®ã§æ£ããã¯ããããããªããããã<!-- Window1.xaml --> <?Mapping XmlNamespace="XmlPersonBinding" ClrNamespace="PersonBinding" ?> <Window x:Class="PersonBinding.Window1" ... xmlns:l="XmlPersonBinding" Title="PersonBinding"> <Window.Resources> <l:AgeToForegroundConverter x:Key="AgeToForegroundConverter" /> <l:People x:Key="Family"> <l:Person Name="Tom" Age="9" /> <l:Person Name="John" Age="11" /> <l:Person Name="Melissa" Age="36" /> </l:People> <DataTemplate DataType="{x:Type l:Person}"> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding Path=Name}" /> <TextBlock Text=" (age: " /> <TextBlock Text="{Binding Path=Age}" Foreground="{Binding Path=Age, Converter={StaticResource AgeToForegroundConverter}}" /> <TextBlock Text=")" /> </StackPanel> </DataTemplate> </Window.Resources> <Grid DataContext="{StaticResource Family}"> ... </Grid> </Window>
æ¸ç±ä¸ã®ä¾ã¯ãXmlDataProviderã使ã£ããã®ã®ããã§ãããªã¹ããã¼ã¿ã¸ã®ãã¤ã³ãã£ã³ã°ã®ãµã³ãã«ãªã®ã§ãããããªãã¸ã§ã¯ãã®ã³ã¬ã¯ã·ã§ã³ã§ãããã¨ãXMLã§è¡¨è¨ããã¦ãããã¨æ¬è³ªçã«å¤ãããªãã®ã«ããªãã§ä¾ãå¤ããã®ããããããããæ¬æã§ã¯ãã®ãã¨ã«ãµãã¦ãã¾ããã
P.144 ä¾4-24
éè¦ãªé¨åããã£ããæ¶ãã¦ã¾ããã<?Mapping XmlNamespace="XmlPersonBinding" ClrNamespace="PersonBinding" ?> <Window ... Title="PersonBinding"> <Window.Resources> <l:AgeToForegroundConverter x:Key="AgeToForegroundConverter" /> ... </XmlDataProvider> </Window.Resources> <Grid DataContext="{StaticResource Family}"> ... <ListBox Grid.Row="0" Grid.Column="1" ItemsSource="{Binding}" IsSynchronizedWithCurrentItem="True" Margin="5" > ... </ListBox> <TextBlock ...>Name:</TextBlock> <TextBox Text= "{Binding XPath=@Name}" Grid.Row="1" Grid.Column="1" Margin="5" /> <TextBlock ...>Age:</TextBlock> <TextBox Text="{Binding XPath=@Age}" Foreground= "{Binding XPath=@Age, Converter={StaticResource AgeToForegroundConverter}}" Grid.Row="2" Grid.Column="1" Margin="5" /> ... </Grid> </Window>
å¤åããããªæãã§ãããã
P.158
family.xmlãã¡ã¤ã«ãæãç¸å¯¾URL
ãããªè¨è¿°ä¾4-40ã«ã¯ç¡ãã¨æãã®ã§ããã»ã»ã»
<XmlDataProvider x:Key="Family" Source="family.xml" XPath="/Family/Person" />
ããã§ã¯ãXmlDataProviderã¯ãã®ããã«è¨è¿°ãã¦ããã¹ãã ã¨æãã¾ãã