Search Results

Search found 2 results on 1 pages for 'flurreh'.

Page 1/1 | 1 

  • WPF TreeViewItem + Change the Highlight Color

    - by flurreh
    Hello, I have got a TreeView with a HierarchicalDataTemplate. <HierarchicalDataTemplate x:Key="treeViewItemTemplate" ItemsSource="{Binding GetChildren}"> <DockPanel Margin="0,8,8,0"> <Image Source="{Binding GetImage}" Width="16" Height="16" /> <local:MonitorTriStateCheckBox Margin="4,0,0,0" IsChecked="{Binding IsChecked}" Click="CheckBox_Clicked" Tag="{Binding UniqueKey}" Style="{DynamicResource CheckBox}"></local:MonitorTriStateCheckBox> <TextBlock Margin="4,0,0,0" Text="{Binding Name}" Style="{DynamicResource TextBlock}"> </TextBlock> </DockPanel> <HierarchicalDataTemplate.Triggers> <Trigger Property="TreeViewItem.IsSelected" Value="True"> <Setter Property="TreeViewItem.Background" Value="Orange" /> </Trigger> </HierarchicalDataTemplate.Triggers> </HierarchicalDataTemplate> As you can see in the code, i set the is selected Trigger of the TreeViewItem, but this has no effect. I alos tried this: <TreeView.ItemContainerStyle> <Style TargetType="{x:Type TreeViewItem}"> <Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" /> <Setter Property="Visibility" Value="{Binding IsVisible, Mode=TwoWay}" /> <Style.Triggers> <Trigger Property="IsSelected" Value="True"> <Setter Property="Background" Value="Orange" /> </Trigger> </Style.Triggers> </Style> </TreeView.ItemContainerStyle> But that had no effect either. Has anyone got an idea what to do, to change the hightlight color of a TreeViewItem?

    Read the article

  • C# XMLWriter + prevent "/" "<" "<" chars

    - by flurreh
    Hello, I have a xmlWriter and want to write String which containt chars of "/" "<" "" (which are part of the xml syntax and break the xml code). Here is my c# code: public Boolean Initialize(String path) { Boolean result = true; XmlWriterSettings settings = new XmlWriterSettings(); settings.CheckCharacters = true; settings.Encoding = Encoding.UTF8; settings.Indent = true; xmlWriter = XmlWriter.Create(path, settings); xmlWriter.WriteStartDocument(); xmlWriter.WriteStartElement("TestData"); isInitialized = true; return result; } public void WriteProducts(List<Product> productList) { if (isInitialized == true) { foreach (Product product in productList) { xmlWriter.WriteStartElement("Product"); xmlWriter.WriteElementString("Id", product.ProdId); xmlWriter.WriteElementString("Name", product.ProdName); xmlWriter.WriteElementString("GroupId", product.ProdGroup); xmlWriter.WriteElementString("Price", product.ProdPrice.ToString((Consts.FORMATTED_PRICE))); xmlWriter.WriteEndElement(); } } } public void Close() { xmlWriter.WriteEndElement(); xmlWriter.WriteEndDocument(); } The application runs without any errors, but if I look in the xml file, the xml is incomplete because the xmlwriter stops writing the product nodes when a product name contains one of the above mentioned characters. Is there a way to fix this problem?

    Read the article

1