1 / 33

Pimp My Listbox

Pimp My Listbox. Rainer Stropek cubido business solutions gmbh. ElementBaum. Window. StackPanel. TextBlock. TextBox. Logischer und. visueller Baum. Border. AdornerDecorator. ContentPresenter. Window. AdornerLayer. StackPanel. TextBlock. String. TextBox. String.

geona
Download Presentation

Pimp My Listbox

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PimpMyListbox Rainer Stropekcubidobusinesssolutionsgmbh

  2. enter the the presentation name in the footer field

  3. ElementBaum Window StackPanel TextBlock TextBox

  4. Logischer und visueller Baum Border AdornerDecorator ContentPresenter Window AdornerLayer StackPanel TextBlock String TextBox String ... (ScrollViewer, Grid, Rectangle, ScrollBar, etc.)

  5. [ContentPropertyAttribute("Items")] [LocalizabilityAttribute(LocalizationCategory.None, Readability=Readability.Unreadable)] [StyleTypedPropertyAttribute(Property="ItemContainerStyle", StyleTargetType=typeof(FrameworkElement))] public class ItemsControl : Control, IAddChild <ListBox> <TextBlock Text="MyTextBlock" /> <Button Content="My Button" /> <Rectangle Width="30" Height="10" Fill="Gray" /> <sys:String>Ein Text!</sys:String> <sys:Random /> </ListBox>

  6. Füllen einer Listbox im XAML-Code Demo...

  7. <Page ... xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:sysio="clr-namespace:System.IO;assembly=mscorlib" Margin="10"> <Page.Resources> <ObjectDataProvider ObjectType="{x:Type sysio:DirectoryInfo}" MethodName="GetFiles" x:Key="Files"> <ObjectDataProvider.ConstructorParameters> <sys:String>[...]\Images</sys:String> </ObjectDataProvider.ConstructorParameters> </ObjectDataProvider> </Page.Resources> <ListBox ItemsSource="{Binding Source={StaticResource Files}}" /> </Page>

  8. Füllen einer Listbox mit Data Binding Demo...

  9. Resourcen Lokale Resourcen <ListBox ..."> <ListBox.Resources> <Style TargetType="ListBox"> ... </Style> </ListBox.Resources> </ListBox> Resourcen in Windows oder Pages Resourcen in app.xaml <Page.Resources> <Style TargetType="ListBox"> ... </Style> <Style TargetType="ListBoxItem"> ... </Style> </Page.Resources> <Application.Resources> <Style TargetType="ListBox"> ... </Style> ... </Application.Resources>

  10. Styles <ListBoxGrid.Column="0" Grid.Row="1" ItemsSource="{Binding Source={StaticResource Files}}"> <ListBox.Resources> <Style TargetType="ListBox"> <Setter Property="Background" Value="LightGray" /> <Setter Property="FontSize" Value="11" /> </Style> </ListBox.Resources> </ListBox>

  11. Styling der Listbox Demo...

  12. Templates

  13. Data Trigger <DataTemplateDataType="{x:Type sysio:FileInfo}"> ... <DataTemplate.Triggers> <DataTrigger Binding="{Binding Path=IsReadOnly}" Value="True"> <Setter Property="TextBlock.Foreground" Value="Gray" /> <Setter Property="TextBlock.FontStyle" Value="Italic" /> </DataTrigger> </DataTemplate.Triggers> </DataTemplate>

  14. Data Template mit Data Trigger Demo...

  15. Control Template <Style TargetType="Button"> <Setter Property="Template"> <Setter.Value> <ControlTemplateTargetType="Button"> <Grid> <Ellipse Fill="{StaticResourceButtonBrush}" Stroke="DarkGray" /> <ContentPresenterHorizontalAlignment="Center" VerticalAlignment="Center" /> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style>

  16. Control Template mit Trigger Demo...

  17. <ListBoxScrollViewer.HorizontalScrollBarVisibility="Disabled"><ListBoxScrollViewer.HorizontalScrollBarVisibility="Disabled"> <ListBox.ItemsPanel> <ItemsPanelTemplate> <WrapPanel /> </ItemsPanelTemplate> </ListBox.ItemsPanel> <TextBlock Text="MyTextBlock" /> <Button Content="My Button" /> <Rectangle Width="30" Height="10" Fill="Gray" /> <sys:String>Ein Text!</sys:String> <sys:Random /> ... </ListBox>

  18. ListBox mit WrapPanel statt StackPanel Demo…

  19. ItemsPanelTemplate, individuelles Panel Demo...

  20. Custom Controls

  21. Custom Control Demo...

  22. enter the the presentation name in the footer field

  23. r.stropek@cubido.at oder rainer@software-architects.at Karin Huber, Rainer Stropek Software Architects

More Related