Why does adding images to an ImageList in the Designer cause them to lose their alpha channel ?
It looks like the ImageList editor loses the transparency when it does some internal copy or clone of the images. However, it seems that it does work when you add the images in code to the ImageList. One workaround (not so tidy) is to add the images to the ImageList at design-time (so that your design-time will be closer to the run-time) and then clear that ImageList and refill it with the images in code.
How can I make sure that a GridSplitter Is visible ?
To prevent hidden GridSplitter controls, do one of the following : Make sure that the GridSplitter controls are the last Children added to the Grid. The following example shows the GridSplitter as the last element in the Children collection of the Grid. [XAML] <Grid> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition/> </Grid.ColumnDefinitions> <Button Grid.Column='0'/> <GridSplitter Grid.Column ='0' Background='Blue'/> </Grid> Set the ‘Zindex’ Property on the GridSplitter to be higher than a control that would otherwise hide it. The following example gives the GridSplitter control a higher ’Zindex’ Property than the Button control. [XAML] <Grid> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition/> </Grid.ColumnDefinitions> <GridSplitter Grid.Column='0' Background='Blue' Panel.ZIndex='1'/> <Button Grid.Column='0'/> </Grid> Set margins on the control that would otherwise hide the GridSplitter so that the GridSplitter is exposed. The following example sets margins on a control that would otherwise overlay and hide the GridSplitter. [XAML] <Grid> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition/> </Grid.ColumnDefinitions> <GridSplitter Grid.Column ='0' Background='Blue'/> <Button Grid.Column='0' Margin='0,0,5,0'/> </Grid>
How can I create a GroupBox that has a title and a visible border that encloses it’s content ?
This can be created with the following piece of code. [XAML] <GroupBox Width='300' Height='410'> <GroupBox.Header> <Label>Employee Data</Label> </GroupBox.Header> <StackPanel> <TabControl Name='myTabControl' TabStripPlacement='Top' Margin='0, 0, 0, 10' Height='350' > <TabItem Name='PersonalInfo'> <TabItem.Header>_Personal Info</TabItem.Header> <StackPanel> <TextBlock>Employee</TextBlock> <TextBlock>Select your name</TextBlock> <ListBox Name='empName' SelectionChanged='updateSummary'> <ListBoxItem IsSelected='true'>Esther</ListBoxItem> <ListBoxItem>George</ListBoxItem> <ListBoxItem>Alan</ListBoxItem> <ListBoxItem>Eric</ListBoxItem> </ListBox> </StackPanel> </TabItem> <TabItem> <TabItem.Header>_Job Info</TabItem.Header> <StackPanel> <TextBlock>Select a job</TextBlock> <ListBox Name ='job' SelectionChanged='updateSummary'> <ListBoxItem IsSelected='true'>Programmer</ListBoxItem> <ListBoxItem>Tester</ListBoxItem> <ListBoxItem>Writer</ListBoxItem> <ListBoxItem>Manager</ListBoxItem> </ListBox> </StackPanel> </TabItem> <TabItem Name='Skill'> <TabItem.Header>_Skill</TabItem.Header> <StackPanel> <TextBlock> Select your strongest skill </TextBlock> <ListBox Name='skills' SelectionChanged='updateSummary'> <ListBoxItem IsSelected='true'>C#</ListBoxItem> <ListBoxItem>Visual Basic</ListBoxItem> <ListBoxItem>.NET</ListBoxItem> <ListBoxItem>JScript</ListBoxItem> </ListBox> </StackPanel> </TabItem> <TabItem Name='Summary' > <TabItem.Header>Su_mmary</TabItem.Header> <StackPanel> <TextBlock Name='emp'/> <TextBlock Name='ejob'/> <TextBlock Name='eskill'/> </StackPanel> </TabItem> </TabControl> <Button Content='Show Summary' Click='goToSummaryTab'/> </StackPanel> </GroupBox>
How to load an XPS document into the DocumentViewer?
XPS documents can be easily loaded into the documentviewer. Here’s the code snippet. [XAML] <DocumentViewer Name='documentViewer' /> [C#] XpsDocument xpsDocument = new XpsDocument('sample.xps', FileAccess.Read); documentViewer.Document = xpsDocument;
How can I create an Expander with a ScrollViewer ?
This example shows how to create an Expander control that contains complex content such as an image and text. The example also encloses the content of the Expander in a ’ScrollViewer’ control. [XAML] <Expander Width='200' HorizontalContentAlignment='Stretch'> <Expander.Header> <BulletDecorator> <BulletDecorator.Bullet> <Image Width='10' Source='images\icon.jpg'/> </BulletDecorator.Bullet> <TextBlock Margin='20,0,0,0'>My Expander</TextBlock> </BulletDecorator> </Expander.Header> <Expander.Content> <ScrollViewer Height='50'> <TextBlock TextWrapping='Wrap'> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </TextBlock> </ScrollViewer> </Expander.Content> </Expander>