Search Results

Search found 159 results on 7 pages for 'relativesource'.

Page 7/7 | < Previous Page | 3 4 5 6 7 

  • [WPF] ComboBox Style problems with DisplayMemberPath

    - by kornelijepetak
    I have a ComboBox and I have set the combo.ItemsSource property to a List object. The Book class contains two properties: "Abbreviation" and "Name". I have set the ComboBox's DisplayMemberPath to "Abbreviation" but the following style that is set on the ComboBox does not display the Abbreviation property, but instead shows "Words.Book" which is the name of the class. The ComboBox drop-down displays a list correctly (Using the specified Abbreviation property). The problem is in the selected ComboBox item, the one displayed when the ComboBox' drop-down is closed. I guess the problem is in ContentPresenter in DataTemplate but I was unable to find a successful solution. Currently the ContentPresenter's Content property is set to Content="{TemplateBinding Content} but I don't know if that's how it should be. Any ideas how to show the property specified in DisplayMemberPath on the selected item? Thank you the code: <ControlTemplate x:Key="ComboBoxToggleButton" TargetType="ToggleButton"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition /> <ColumnDefinition Width="20" /> </Grid.ColumnDefinitions> <Border x:Name="Border" Grid.ColumnSpan="2" CornerRadius="2" BorderThickness="1" Background="{DynamicResource ribbonTitleFade}" /> <Border Grid.Column="0" CornerRadius="2,0,0,2" Margin="1,6,1,6" BorderBrush="{DynamicResource boSecE}" BorderThickness="0,0,1,0" /> <Path x:Name="Arrow" Grid.Column="1" Fill="White" HorizontalAlignment="Center" VerticalAlignment="Center" Data="M 0 0 L 4 4 L 8 0 Z" /> </Grid> <ControlTemplate.Triggers> <Trigger Property="ToggleButton.IsMouseOver" Value="true"> <Setter TargetName="Border" Property="Background" Value="{DynamicResource ribbonTitleFade}" /> </Trigger> <Trigger Property="ToggleButton.IsChecked" Value="true"> <Setter TargetName="Border" Property="Background" Value="{DynamicResource ribbonTitleFade}" /> </Trigger> <Trigger Property="IsEnabled" Value="False"> <Setter TargetName="Border" Property="Background" Value="Black" /> <Setter TargetName="Border" Property="BorderBrush" Value="Black" /> <Setter Property="Foreground" Value="Gray"/> <Setter TargetName="Arrow" Property="Fill" Value="Gray" /> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> <Style x:Key="comboBoxBorderTransparent" TargetType="Control"> <Setter Property="BorderBrush" Value="{DynamicResource boPrimC}" /> </Style> <Style x:Key="comboItemStyle" TargetType="ComboBoxItem"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ComboBoxItem}"> <Border x:Name="backBorder" > <StackPanel Orientation="Horizontal"> <Rectangle x:Name="rectA" Stroke="White" Width="4" Height="4" Fill="#80FFFFFF" Margin="5,0,0,0" HorizontalAlignment="Left" /> <TextBlock x:Name="text" Foreground="White" FontSize="10px"> <ContentPresenter Margin="8,1,0,1" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" /> </TextBlock> </StackPanel> </Border> <ControlTemplate.Triggers> <Trigger Property="ComboBoxItem.IsMouseOver" Value="true"> <Setter TargetName="rectA" Property="Stroke" Value="Black" /> <Setter TargetName="rectA" Property="Fill" Value="#80000000" /> <Setter TargetName="backBorder" Property="Background" Value="White"/> <Setter TargetName="text" Property="Foreground" Value="{DynamicResource boPrimC}"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> <DataTemplate x:Key="comboSelectedItemTemplate"> <TextBlock Foreground="White" FontSize="10px"> <ContentPresenter Content="{TemplateBinding Content}" /> </TextBlock> </DataTemplate> <Style TargetType="ComboBox"> <Setter Property="SnapsToDevicePixels" Value="true"/> <Setter Property="OverridesDefaultStyle" Value="true"/> <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/> <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/> <Setter Property="ScrollViewer.CanContentScroll" Value="true"/> <Setter Property="MinWidth" Value="60"/> <Setter Property="MinHeight" Value="20"/> <Setter Property="ItemContainerStyle" Value="{DynamicResource comboItemStyle}"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="ComboBox"> <Grid> <ToggleButton Name="ToggleButton" Grid.Column="2" Template="{StaticResource ComboBoxToggleButton}" Focusable="false" IsChecked="{Binding Path=IsDropDownOpen,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}" ClickMode="Press"> </ToggleButton> <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Name="ContentSite" IsHitTestVisible="False" Content="{TemplateBinding SelectionBoxItem}" ContentTemplate="{DynamicResource comboSelectedItemTemplate}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" Margin="3,3,23,3" /> <Popup Name="Popup" Placement="Bottom" IsOpen="{TemplateBinding IsDropDownOpen}" AllowsTransparency="False" Focusable="False" PopupAnimation="Slide"> <Grid Name="DropDown" SnapsToDevicePixels="True" MinWidth="{TemplateBinding ActualWidth}" MaxHeight="{TemplateBinding MaxDropDownHeight}"> <Border x:Name="DropDownBorder" Background="{DynamicResource ribbonTitleFade}" BorderThickness="1" BorderBrush="{DynamicResource boPrimC}" /> <ScrollViewer Margin="4,6,4,6" SnapsToDevicePixels="True"> <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" /> </ScrollViewer> </Grid> </Popup> </Grid> <ControlTemplate.Triggers> <Trigger Property="HasItems" Value="false"> <Setter TargetName="DropDownBorder" Property="MinHeight" Value="95"/> </Trigger> <Trigger Property="IsEnabled" Value="false"> <Setter Property="Foreground" Value="Black"/> </Trigger> <Trigger Property="IsGrouping" Value="true"> <Setter Property="ScrollViewer.CanContentScroll" Value="false"/> </Trigger> <Trigger SourceName="Popup" Property="Popup.AllowsTransparency" Value="true"> <Setter TargetName="DropDownBorder" Property="CornerRadius" Value="2"/> <Setter TargetName="DropDownBorder" Property="Margin" Value="0"/> </Trigger> <Trigger Property="IsEditable" Value="true"> <Setter Property="IsTabStop" Value="false"/> <!--<Setter TargetName="ContentSite" Property="Visibility" Value="Hidden"/>--> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> <Style.Triggers> </Style.Triggers> </Style>

    Read the article

  • Style Trigger on Attached Property

    - by vanja.
    I have created my own Attached Property like this: public static class LabelExtension { public static bool GetSelectable(DependencyObject obj) { return (bool)obj.GetValue(SelectableProperty); } public static void SetSelectable(DependencyObject obj, bool value) { obj.SetValue(SelectableProperty, value); } // Using a DependencyProperty as the backing store for Selectable. This enables animation, styling, binding, etc... public static readonly DependencyProperty SelectableProperty = DependencyProperty.RegisterAttached("Selectable", typeof(bool), typeof(Label), new UIPropertyMetadata(false)); } And then I'm trying to create a style with a trigger that depends on it: <!--Label--> <Style TargetType="{x:Type Label}"> <Style.Triggers> <Trigger Property="Util:LabelExtension.Selectable" Value="True"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Label}"> <TextBox IsReadOnly="True" Text="{TemplateBinding Content}" /> </ControlTemplate> </Setter.Value> </Setter> </Trigger> </Style.Triggers> </Style> But I'm getting a run time exception: Cannot convert the value in attribute 'Property' to object of type 'System.Windows.DependencyProperty'. Error at object 'System.Windows.Trigger' in markup file How can I access the value of the attached property in a style trigger? I have tried using a DataTrigger with a RelativeSource binding but it wasn't pulling the value through.

    Read the article

  • Working with Resources in WPF

    - by Coesy
    I am wanting to use the example from http://blogs.microsoft.co.il/blogs/tomershamam/archive/2008/09/22/lt-howto-gt-replace-listview-columns-with-rows-lt-howto-gt.aspx However I don't want to put this into the App.xaml code as this will apply to ALL gridviews, how do I apply this example to a select few gridviews in the application? The Resources look like this <Style TargetType="{x:Type GridViewHeaderRowPresenter}"> <Setter Property="Height" Value="80" /> <Setter Property="LayoutTransform"> <Setter.Value> <TransformGroup> <RotateTransform Angle="-90" /> <ScaleTransform ScaleY="-1" /> </TransformGroup> </Setter.Value> </Setter> </Style> <Style TargetType="{x:Type GridViewRowPresenter}"> <Setter Property="LayoutTransform"> <Setter.Value> <TransformGroup> <RotateTransform Angle="-90" /> <ScaleTransform ScaleY="-1" /> </TransformGroup> </Setter.Value> </Setter> </Style> <LinearGradientBrush x:Key="GridViewColumnHeaderBackground" EndPoint="0,1" StartPoint="0,0"> <GradientStop Color="#FFFFFFFF" Offset="0"/> <GradientStop Color="#FFFFFFFF" Offset="0.4091"/> <GradientStop Color="#FFF7F8F9" Offset="1"/> </LinearGradientBrush> <LinearGradientBrush x:Key="GridViewColumnHeaderBorderBackground" EndPoint="0,1" StartPoint="0,0"> <GradientStop Color="#FFF2F2F2" Offset="0"/> <GradientStop Color="#FFD5D5D5" Offset="1"/> </LinearGradientBrush> <LinearGradientBrush x:Key="GridViewColumnHeaderHoverBackground" EndPoint="0,1" StartPoint="0,0"> <GradientStop Color="#FFBDEDFF" Offset="0"/> <GradientStop Color="#FFB7E7FB" Offset="1"/> </LinearGradientBrush> <LinearGradientBrush x:Key="GridViewColumnHeaderPressBackground" EndPoint="0,1" StartPoint="0,0"> <GradientStop Color="#FF8DD6F7" Offset="0"/> <GradientStop Color="#FF8AD1F5" Offset="1"/> </LinearGradientBrush> <Style x:Key="GridViewColumnHeaderGripper" TargetType="{x:Type Thumb}"> <Setter Property="Canvas.Right" Value="-9"/> <Setter Property="Width" Value="18"/> <Setter Property="Height" Value="{Binding Path=ActualHeight, RelativeSource={RelativeSource TemplatedParent}}"/> <Setter Property="Padding" Value="0"/> <Setter Property="Background" Value="{StaticResource GridViewColumnHeaderBorderBackground}"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Thumb}"> <Border Background="Transparent" Padding="{TemplateBinding Padding}"> <Rectangle Fill="{TemplateBinding Background}" HorizontalAlignment="Center" Width="1"/> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style TargetType="{x:Type GridViewColumnHeader}"> <Setter Property="HorizontalContentAlignment" Value="Center"/> <Setter Property="VerticalContentAlignment" Value="Center"/> <Setter Property="Background" Value="{StaticResource GridViewColumnHeaderBackground}"/> <Setter Property="BorderBrush" Value="{StaticResource GridViewColumnHeaderBorderBackground}"/> <Setter Property="BorderThickness" Value="0"/> <Setter Property="Padding" Value="2,0,2,0"/> <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type GridViewColumnHeader}"> <Grid SnapsToDevicePixels="true"> <Border x:Name="HeaderBorder" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0,1,0,1"> <Grid> <Grid.RowDefinitions> <RowDefinition MaxHeight="7"/> <RowDefinition/> </Grid.RowDefinitions> <Rectangle Fill="#FFE3F7FF" x:Name="UpperHighlight" Visibility="Collapsed"/> <Border Grid.RowSpan="2" Padding="{TemplateBinding Padding}"> <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="0,0,0,1" x:Name="HeaderContent" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" RecognizesAccessKey="True"> <ContentPresenter.LayoutTransform> <TransformGroup> <ScaleTransform ScaleY="-1" /> <RotateTransform Angle="90" /> </TransformGroup> </ContentPresenter.LayoutTransform> </ContentPresenter> </Border> </Grid> </Border> <Border Margin="1,1,0,0" x:Name="HeaderHoverBorder" BorderThickness="1,0,1,1"/> <Border Margin="1,0,0,1" x:Name="HeaderPressBorder" BorderThickness="1,1,1,0"/> <Canvas> <Thumb x:Name="PART_HeaderGripper" Style="{StaticResource GridViewColumnHeaderGripper}"/> </Canvas> </Grid> <ControlTemplate.Triggers> <Trigger Property="IsMouseOver" Value="true"> <Setter Property="Background" TargetName="HeaderBorder" Value="{StaticResource GridViewColumnHeaderHoverBackground}"/> <Setter Property="BorderBrush" TargetName="HeaderHoverBorder" Value="#FF88CBEB"/> <Setter Property="Visibility" TargetName="UpperHighlight" Value="Visible"/> <Setter Property="Background" TargetName="PART_HeaderGripper" Value="Transparent"/> </Trigger> <Trigger Property="IsPressed" Value="true"> <Setter Property="Background" TargetName="HeaderBorder" Value="{StaticResource GridViewColumnHeaderPressBackground}"/> <Setter Property="BorderBrush" TargetName="HeaderHoverBorder" Value="#FF95DAF9"/> <Setter Property="BorderBrush" TargetName="HeaderPressBorder" Value="#FF7A9EB1"/> <Setter Property="Visibility" TargetName="UpperHighlight" Value="Visible"/> <Setter Property="Fill" TargetName="UpperHighlight" Value="#FFBCE4F9"/> <Setter Property="Visibility" TargetName="PART_HeaderGripper" Value="Hidden"/> <Setter Property="Margin" TargetName="HeaderContent" Value="1,1,0,0"/> </Trigger> <Trigger Property="Height" Value="Auto"> <Setter Property="MinHeight" Value="20"/> </Trigger> <Trigger Property="IsEnabled" Value="false"> <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> <Style.Triggers> <Trigger Property="Role" Value="Floating"> <Setter Property="Opacity" Value="0.4082"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type GridViewColumnHeader}"> <Canvas x:Name="PART_FloatingHeaderCanvas"> <Rectangle Fill="#FF000000" Width="{TemplateBinding ActualWidth}" Height="{TemplateBinding ActualHeight}" Opacity="0.4697"/> </Canvas> </ControlTemplate> </Setter.Value> </Setter> </Trigger> <Trigger Property="Role" Value="Padding"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type GridViewColumnHeader}"> <Border x:Name="HeaderBorder" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0,1,0,1"/> <ControlTemplate.Triggers> <Trigger Property="Height" Value="Auto"> <Setter Property="MinHeight" Value="20"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Trigger> </Style.Triggers> </Style> I have tried creating a usercontrol and sticking that lot in the UserControl.Resources section but it didn't work, I can only get this example to work if i put them into the Application.Resources section which i obviously don't want. Help!! :-)

    Read the article

  • How can I change the visibility of elements inside a DataTemplate when a row is selected in a Silver

    - by miketrash
    I'm using the MVVM pattern. I've bound my items and I want to only show the edit button when a row is selected in the datagrid. It appears to be possible with triggers in WPF but we don't have triggers in Silverlight. I tried a TemplatedParent binding but I'm not sure what the TemplatedParent is in this case. We don't have RelativeSource ancestor in Silverlight either. At this point I'm going to look at a solution using the code behind... <data:DataGrid.Columns> <data:DataGridTemplateColumn IsReadOnly="True" Header="Name" Width="300"> <data:DataGridTemplateColumn.CellTemplate> <DataTemplate> <Grid> <TextBlock x:Name="textBlock" Text="{Binding Name, Mode=OneWay}" VerticalAlignment="Center" Margin="4,4,0,4"/> <Button Margin="1,1,4,1" HorizontalAlignment="Right" VerticalAlignment="Center" Padding="7,4" Content="Edit" /> </Grid> </DataTemplate> </data:DataGridTemplateColumn.CellTemplate> </data:DataGridTemplateColumn> </data:DataGrid.Columns>

    Read the article

  • Can I change the binding source to another source in XAML?

    - by No hay Problema
    Hi guys, I want to do a very simple thing, can you point me on the right direction? I want to change the source in XAML to another object source, let me put you an example: I have a Listview, bound to a "Model A", it has many properties, but one is called "Total". This property is not shown on the View Each ListviewItem has its own source (ItemsSource), BUT, one of the fields should show "Total" from "Model A" Caveat: I am implementing MVVM, so the "Model A" is assigned as a VM DataSource, XAML knows nothing about it. So, in my perfect world the XAML should look like this: <GridViewColumn Header="Total" Width="150"> <GridViewColumn.CellTemplate> <DataTemplate> <Label Content="{Binding Source=<The source of LISTVIEW> Path=Total}"/> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> I have tried RelativeSource but that points me to the XAML object, I want the source of it, is it possible? Thanks

    Read the article

  • Custom progress bar label text via binding

    - by Alexander K
    I was playing with progress bar customization in Silverlight application. What I want to reach is to have progress bar label to show current its state in the following format: "Value / Maximum". So, user will see what is the current value, and what is the maximum possible value. Here is a style for progress bar I use: <Style x:Key="ProgressBarStyle" TargetType="ProgressBar"> <Setter Property="Width" Value="97.21" /> <Setter Property="Height" Value="19" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="ProgressBar"> <Canvas x:Name="LevelField" Width="99" Height="21"> ... <TextBlock ... DataContext="{TemplateBinding Value}" Text="{Binding Converter={StaticResource DecNumberToStringConverter}}"/> </Canvas> </ControlTemplate> </Setter.Value> </Setter> </Style> The way I want to implement this, is to have a value converter, that will convert current value and maximum possible into the proper string. It does work properly, if it is written like above. However, I also need to provide ConverterParameter for Convertor, but not sure how to make it. When I write like this: , ConvertParameter={Binding Maximum}, it shows error on start, that Text attribute is not found in TextBlock. I was also trying to set DataContext as {RelativeSource Self}, but then it didn't displays error that DataContext attribute is not found. How to make the described progress bar label properly?

    Read the article

  • Failed to create a 'System.Windows.RoutedEventHandler' from the text 'Button_Click'

    - by ay89
    In my windows phone 8 application, while trying to create a dependency property I am always getting this exception. what I am doing wrong, plz guide me. {System.Windows.Markup.XamlParseException: Failed to create a 'System.Windows.RoutedEventHandler' from the text 'Button_Click'. [Line: 108 Position: 66] at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator) at com.sap.View.HomePage.InitializeComponent() at com.sap.View.HomePage..ctor()} this is code-behind of Header public static readonly DependencyProperty MenuClickProperty = DependencyProperty.Register("MenuClick", typeof(RoutedEventHandler), typeof(Header), new PropertyMetadata(OnMenuClickHandlerChanged)); public RoutedEventHandler MenuClick { get { return (RoutedEventHandler)GetValue(MenuClickProperty); } set { SetValue(MenuClickProperty, new RoutedEventHandler(value)); } } private static void OnMenuClickHandlerChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { Header header = d as Header; header.OnMenuClickHandlerPropertyChanged(e); } private void OnMenuClickHandlerPropertyChanged(DependencyPropertyChangedEventArgs e) { MenuButton.Click += MenuClick; } this is in my user control (Header) <Button Click="{Binding Path=MenuClick, Source={RelativeSource Mode=Self}}" /> this is how i am including control on my Page: <myControls:Header Title="{Binding Title}" MenuClick="Button_Click" /> this is in code-behind: public void Button_Click(object sender, RoutedEventArgs e) { OpenSettings(); }

    Read the article

  • Silverlight 5 Hosting :: Features in Silverlight 5 and Release Date

    - by mbridge
    Silverlight 5 is finally announced in the Silverlight FireStarter Event on the 2nd December, 2010. This new version of Silverlight which was earlier labeled as 'Future of Microsoft Silverlight' has now come much closer to go live as the first Silverlight 5 Beta version is expected to be shipped during the early months of 2011. However for the full fledged and the final release of Silverlight 5, we have to wait many more months as the same is likely to be made available within the Q3 2011. As would have been usually expected, this latest edition would feature many new capabilities thereby extending the developer productivity to a whole new dimension of premium media experience and feature-rich business applications. It comes along with many new feature updates as well as the inclusion of new technologies to improve the standard of the Silverlight applications which are now fine-tuned to produce next generation business and media solutions that is capable to meet the requirements of the advanced web-based app development. The Silverlight 5 is all set to replace the previous fourth version which now includes more than forty new features while also dropping various deprecated elements that was prevalent earlier. It has brought around some major performance enhancements and also included better support for various other tools and technologies. Following are some of the changes that are registered to be available under the Silverlight 5 Beta edition which is scheduled to be launched during the Q1 2011. Silverlight 5 : Premium Media Experiences The media features of Silverlight 5 has seen some major enhancements with a lot of optimizations being made to deliver richer solutions. It's capability has now been extended to make things easier, faster and capable of performing the desired tasks in the most efficient manner. The Silverlight media solutions has already been a part of many companies in the recent days where various on-demand Silverlight services were featured but with the arrival of the next generation premium media solution of Silverlight 5, it is expected to register new heights of success and global user acclamation for using it with many esteemed web-based projects and media solutions. - The most happening element in the new Silverlight 5 will be its support for utilizing the GPU based hardware acceleration which is intended to lower down the CPU load to a significant extent and thereby allowing faster rendering of media contents without consuming much resources. This feature is believed to be particularly helpful for low configured machines to run full HD media content without any lagging caused due to processor load. It will hence be one great feature to revolutionize the new generation high quality media contents to be available within the web in a more efficient manner with its hardware decoded video playback capabilities. - With the inclusion of hardware video decoding to minimize the processor load, the Silverlight 5 also comes with another optimization enhancement to also reduce the power consumption level by making new methods to deal with the power-saver settings. With this optimization in effect, the computer would be automatically allowed to switch to sleep mode while no video playback is in progress and also to prevent any screensavers to popup and cause annoyances during any video playback. There would also be other power saver options which will be made available to best suit the users requirements and purpose. - The Silverlight trickplay feature is another great way to tweak any silverlight powered media content as is used for many video tutorial sites or for dealing with any sort of presentations. This feature enables the user to modify the playback speed to either slowdown or speedup during the playback durations based on the requirements without compromising on the quality of output. Normally such manipulations always makes the content's audio to go off-pitch, but the same will not be the case with TrickPlay and the audio would seamlessly progress with the video without skipping any of its part. - In addition to all of the above, the new Silverlight 5 will be featuring wireless control of all the media contents by making use of remote controllers. With the use of such remote devices, it will be easier to handle the various media playback controls thereby providing more freedom while experiencing the premium media services. Silverlight 5 : Business Application Development The application development standard has been extended with more possibilities by bringing forth new and useful technologies and also reviving the existing methods to work better than what it was used to. From the UI improvements to advanced technical aspects, the Silverlight 5 scores high on all grounds to produce great next generation business delivered applications by putting in more creativity and resourceful touch to all the apps being produced with it. - The WPF feature of Silverlight is made more effective by introducing new standards of Databinding which is intended to improve the productivity standards of the Silverlight application developer. It brings in a lot of convenience in debugging the databinding components or expressions and hence making things work in a flawless manner. Some additional features related to databinding includes that of Ancestor RelativeSource, Implicit DataTemplates and Model View ViewModel (MVVM) support with DataContextChanged event and many other new features relating it. - It now comes with a refined text and printing service which facilitates better clarity of the text rendering and also many positive changes which are being applied to the layout pattern. New supports has been added to include OpenType font, multi-column text, linked-text containers and character leading support to name a few among the available features.This also includes some important printing aspects like that of Postscript Vector Printing API which allows to program our printing tasks in a user defined way and Pivot functionality for visualization concerns of informations. - The Graphics support is the key improvements being incorporated which now enables to utilize three dimensional graphics pattern using GPU acceleration. It can manage to provide some really cool visualizations being curved to provide media contents within the business apps with also the support for full HD contents at 1080p quality. - Silverlight 5 includes the support for 64-bit operating systems and relevant browsers and is also optimized to provide better performance. It can support the background thread for the networking which can reduce the latency of the network to a considerable extent. The Out-of-Browser functionality adds the support for utilizing various libraries and also the Win32 API. It also comes with testing support with VS 2010 which is mostly an automated procedure and has also enabled increased security aspects of all the Silverlight 5 developed applications by using the improved version of group policy support.

    Read the article

  • Strange WPF ListBox Behavior

    - by uncle-harvey
    I’m trying to bind a List of items to a listbox in WPF. The items are grouped by one value and each group is to be housed in an expander. Everything works fine when I don’t use any custom styles. However, when I use custom styles (which work properly with non-grouped items and as independent controls) the binding doesn’t display any items. Below is the code I’m executing. Any ideas why the items won’t show up in the Expander? Test.xaml: <Window x:Class="Glossy.Test" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Test" Height="300" Width="300"> <Window.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="..\TestStyles.xaml"/> <ResourceDictionary> <Style x:Key="ContainerStyle" TargetType="{x:Type GroupItem}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate> <Expander Header="{Binding}" IsExpanded="True"> <ItemsPresenter /> </Expander> </ControlTemplate> </Setter.Value> </Setter> </Style> </ResourceDictionary> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Window.Resources> <Grid> <ListBox x:Name="TestList"> <ListBox.GroupStyle> <GroupStyle ContainerStyle="{StaticResource ContainerStyle}"/> </ListBox.GroupStyle> </ListBox> </Grid> Test.xaml.cs: public partial class Test : Window { private List<Contact> _ContactItems; public List<Contact> ContactItems { get { return _ContactItems; } set { _ContactItems = value; } } public Test() { InitializeComponent(); ContactItems = new List<Contact>(); ContactItems.Add(new Contact()); ContactItems.Last().CompanyName = "ABC"; ContactItems.Last().Name = "Contact 1"; ContactItems.Add(new Contact()); ContactItems.Last().CompanyName = "ABC"; ContactItems.Last().Name = "Contact 2"; ContactItems.Add(new Contact()); ContactItems.Last().CompanyName = "ABC"; ContactItems.Last().Name = "Contact 3"; ContactItems.Add(new Contact()); ContactItems.Last().CompanyName = "ABC"; ContactItems.Last().Name = "Contact 10"; ContactItems.Add(new Contact()); ContactItems.Last().CompanyName = "ABC"; ContactItems.Last().Name = "Contact 11"; ContactItems.Add(new Contact()); ContactItems.Last().CompanyName = "ABC"; ContactItems.Last().Name = "Contact 12"; ContactItems.Add(new Contact()); ContactItems.Last().CompanyName = "RST"; ContactItems.Last().Name = "Contact 7"; ContactItems.Add(new Contact()); ContactItems.Last().CompanyName = "RST"; ContactItems.Last().Name = "Contact 8"; ContactItems.Add(new Contact()); ContactItems.Last().CompanyName = "RST"; ContactItems.Last().Name = "Contact 9"; ContactItems.Add(new Contact()); ContactItems.Last().CompanyName = "XYZ"; ContactItems.Last().Name = "Contact 4"; ContactItems.Add(new Contact()); ContactItems.Last().CompanyName = "XYZ"; ContactItems.Last().Name = "Contact 5"; ContactItems.Add(new Contact()); ContactItems.Last().CompanyName = "XYZ"; ContactItems.Last().Name = "Contact 6"; ICollectionView view = CollectionViewSource.GetDefaultView(ContactItems); view.GroupDescriptions.Add(new PropertyGroupDescription("CompanyName")); view.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending)); TestList.ItemsSource = view; } } public class Contact { public string CompanyName { get; set; } public string Name { get; set; } public override string ToString() { return Name; } } TestStyles.xaml: <Style TargetType="{x:Type ListBox}"> <Setter Property="SnapsToDevicePixels" Value="true"/> <Setter Property="OverridesDefaultStyle" Value="true"/> <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/> <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/> <Setter Property="ScrollViewer.CanContentScroll" Value="true"/> <Setter Property="MinWidth" Value="120"/> <Setter Property="MinHeight" Value="95"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="ListBox"> <Grid Background="Black"> <Rectangle VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Fill="White"> <Rectangle.OpacityMask> <DrawingBrush> <DrawingBrush.Drawing> <GeometryDrawing Geometry="M65.5,33 L537.5,35 537.5,274.5 C536.5,81 119.5,177 66.5,92" Brush="#11444444"> <GeometryDrawing.Pen> <Pen Brush="Transparent"/> </GeometryDrawing.Pen> </GeometryDrawing> </DrawingBrush.Drawing> </DrawingBrush> </Rectangle.OpacityMask> </Rectangle> <Border Name="Border" Background="Transparent" BorderBrush="Gray" BorderThickness="1" CornerRadius="2"> <ScrollViewer Margin="0" Focusable="false"> <StackPanel Margin="2" IsItemsHost="True" /> </ScrollViewer> </Border> </Grid> <ControlTemplate.Triggers> <Trigger Property="IsEnabled" Value="false"> <Setter TargetName="Border" Property="Background" Value="Gray" /> <Setter TargetName="Border" Property="BorderBrush" Value="DimGray" /> </Trigger> <Trigger Property="IsGrouping" Value="true"> <Setter Property="ScrollViewer.CanContentScroll" Value="false"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style TargetType="{x:Type ListBoxItem}"> <Setter Property="SnapsToDevicePixels" Value="true"/> <Setter Property="OverridesDefaultStyle" Value="true"/> <Setter Property="Foreground" Value="Gray"/> <Setter Property="Background" Value="Transparent"/> <Setter Property="FontFamily" Value="Verdana"/> <Setter Property="HorizontalAlignment" Value="Stretch"/> <Setter Property="FontSize" Value="11"/> <Setter Property="Margin" Value="3,1,3,1"/> <Setter Property="Padding" Value="0"/> <Setter Property="FontWeight" Value="Normal"/> <Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="ListBoxItem"> <Border Name="Border" Padding="2" SnapsToDevicePixels="true"> <ContentPresenter /> </Border> <ControlTemplate.Triggers> <Trigger Property="IsSelected" Value="true"> <Setter TargetName="Border" Property="Background" Value="Gray"/> </Trigger> <Trigger Property="IsEnabled" Value="false"> <Setter Property="Foreground" Value="White"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> <ControlTemplate x:Key="ExpanderToggleButton" TargetType="ToggleButton"> <Border Name="Border" CornerRadius="2,0,0,0" Background="Transparent" BorderBrush="LightGray" BorderThickness="0,0,1,0"> <Path Name="Arrow" Fill="Blue" HorizontalAlignment="Center" VerticalAlignment="Center" Data="M 0 0 L 4 4 L 8 0 Z"/> </Border> <ControlTemplate.Triggers> <Trigger Property="ToggleButton.IsMouseOver" Value="True"> <Setter TargetName="Border" Property="Background" Value="Gray" /> </Trigger> <Trigger Property="IsPressed" Value="True"> <Setter TargetName="Border" Property="Background" Value="Black" /> </Trigger> <Trigger Property="IsChecked" Value="True"> <Setter TargetName="Arrow" Property="Data" Value="M 0 4 L 4 0 L 8 4 Z" /> </Trigger> <Trigger Property="IsEnabled" Value="False"> <Setter TargetName="Border" Property="Background" Value="DimGray" /> <Setter TargetName="Border" Property="BorderBrush" Value="DimGray" /> <Setter Property="Foreground" Value="LightGray"/> <Setter TargetName="Arrow" Property="Fill" Value="LightBlue" /> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> <Style TargetType="{x:Type Expander}"> <Setter Property="Foreground" Value="White"/> <Setter Property="FontFamily" Value="Verdana"/> <Setter Property="FontSize" Value="11"/> <Setter Property="FontWeight" Value="Normal"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Expander"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Name="ContentRow" Height="0"/> </Grid.RowDefinitions> <Border Name="Border" Grid.Row="0" Background="Black" BorderBrush="DimGray" BorderThickness="1" Cursor="Hand" CornerRadius="2,2,0,0" > <Grid HorizontalAlignment="Left"> <Grid.RowDefinitions> <RowDefinition Height="23"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="20" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <ToggleButton IsChecked="{Binding Path=IsExpanded,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}" Template="{StaticResource ExpanderToggleButton}" Background="Black" /> <Label Grid.Column="1" FontSize="14" FontWeight="Normal" Margin="0" VerticalAlignment="Top" Foreground="White" FontFamily="Verdana"> <ContentPresenter Grid.Column="1" Margin="4,3,0,0" HorizontalAlignment="Left" ContentSource="Header" RecognizesAccessKey="True" /> </Label> </Grid> </Border> <Border Name="Content" Background="Black" BorderBrush="DimGray" BorderThickness="1,0,1,1" Grid.Row="1" CornerRadius="0,0,2,2" > <Grid Background="Black"> <Rectangle VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Fill="White"> <Rectangle.OpacityMask> <DrawingBrush> <DrawingBrush.Drawing> <GeometryDrawing Geometry="M65.5,33 L537.5,35 537.5,274.5 C536.5,81 119.5,177 66.5,92" Brush="#11444444"> <GeometryDrawing.Pen> <Pen Brush="Transparent"/> </GeometryDrawing.Pen> </GeometryDrawing> </DrawingBrush.Drawing> </DrawingBrush> </Rectangle.OpacityMask> </Rectangle> <ContentPresenter Margin="4" /> </Grid> </Border> </Grid> <ControlTemplate.Triggers> <Trigger Property="IsExpanded" Value="True"> <Setter TargetName="ContentRow" Property="Height" Value="{Binding ElementName=Content,Path=DesiredHeight}" /> </Trigger> <Trigger Property="IsEnabled" Value="False"> <Setter TargetName="Border" Property="Background" Value="Gray" /> <Setter TargetName="Border" Property="BorderBrush" Value="DimGray" /> <Setter Property="Foreground" Value="White"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style>

    Read the article

< Previous Page | 3 4 5 6 7