Search Results

Search found 18 results on 1 pages for 'xmldataprovider'.

Page 1/1 | 1 

  • Binding to XMLDataProvider in Code Behind

    - by Robert Vernunft
    Hello, i have a problem moving a XMLDataprovider Binding with XPath from Xaml to code behind. Labels.xml <?xml version="1.0" encoding="utf-8" ?> <Labels> <btnOne Label="Button1"/> <btnTwo Label="Button2"/> </Labels> MainWindow.xaml <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="bindings.MainWindow" Title="MainWindow" Height="350" Width="525"> <Window.Resources> <XmlDataProvider x:Key="XMLLabels" Source="Labels.xml" XPath="Labels"/> </Window.Resources> <Grid> <Button Content="{Binding Source={StaticResource XMLLabels}, XPath=btnOne/@Label}" Height="23" HorizontalAlignment="Left" Margin="12,12,0,276" Name="btnOne" Width="75" /> <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="93,12,0,276" Name="btnTwo" Width="75" Loaded="btnTwo_Loaded" /> </Grid> </Window> MainWindow.xaml.cs ... private void btnTwo_Loaded(object sender, RoutedEventArgs e) { String Type = sender.GetType().Name; if (Type == "Button") { Button btn = sender as Button; Binding label = new Binding("XMLBind"); XmlDataProvider xmlLabels = (XmlDataProvider)this.FindResource("XMLLabels"); label.Source = xmlLabels; label.XPath = "btnTwo/@Header"; btn.SetBinding(Button.ContentProperty, label); } } ... The binding to content of btnOne works as aspected "Button1". But btnTwo is set to an empty string. The Output shows no errors. Thanks for any advice.

    Read the article

  • XmlDataProvider authentication Http issue

    - by Allen Ho
    Hi, I have an XMLDataProvider IsAsynchronous="True" x:Key="xmlData" Source="http://192.168.15.90/text.xml"/ The only problem is the Source requires authtication. I can get around this but using a HttpWebRequest in which I can pass in NetworkCredentials, but I was just wondering if there was a simpler way of passing in credentials to the XMLDataProvider

    Read the article

  • XmlDataProvider and XPath bindings don't allow default namespace of XML data?

    - by Andy Dent
    I am struggling to work out how to use default namespaces with XmlDataProvider and XPath bindings. There's an ugly answer using local-name <Binding XPath="*[local-name()='Name']" /> but that is not acceptable to the client who wants this XAML to be highly maintainable. The fallback is to force them to use non-default namespaces in the report XML but that is an undesirable solution. The XML report file looks like the following. It will only work if I remove xmlns="http://www.acme.com/xml/schemas/report so there is no default namespace. <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type='text/xsl' href='PreviewReportImages.xsl'?> <Report xsl:schemaLocation="http://www.acme.com/xml/schemas/report BlahReport.xsd" xmlns:xsl="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.acme.com/xml/schemas/report"> <Service>Muncher</Service> <Analysis> <Date>27 Apr 2010</Date> <Time>0:09</Time> <Authoriser>Service Centre Manager</Authoriser> Which I am presenting in a window with XAML: <Window x:Class="AcmeTest.ReportPreview" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="ReportPreview" Height="300" Width="300" > <Window.Resources> <XmlDataProvider x:Key="Data"/> </Window.Resources> <StackPanel Orientation="Vertical" DataContext="{Binding Source={StaticResource Data}, XPath=Report}"> <TextBlock Text="{Binding XPath=Service}"/> </StackPanel> </Window> with code-behind used to load an XmlDocument into the XmlDataProvider (seems the only way to have loading from a file or object varying at runtime). public partial class ReportPreview : Window { private void InitXmlProvider(XmlDocument doc) { XmlDataProvider xd = (XmlDataProvider)Resources["Data"]; xd.Document = doc; } public ReportPreview(XmlDocument doc) { InitializeComponent(); InitXmlProvider(doc); } public ReportPreview(String reportPath) { InitializeComponent(); var doc = new XmlDocument(); doc.Load(reportPath); InitXmlProvider(doc); } }

    Read the article

  • Converter problem with XmlDataProvider

    - by Andrew
    Sorry for this, I've just started programming with wpf. I can't seem to figure out why the following xaml displays "System.Xml.XmlElement" instead of the actual xml node content. This is displayed 5 times in the listbox whenever I run it. Not sure where I'm going wrong... <Window x:Class="TestBinding.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> <Window.Resources> <XmlDataProvider x:Key="myXmlSource" XPath="/root"> <x:XData> <root xmlns=""> <name>Steve</name> <name>Arthur</name> <name>Sidney</name> <name>Billy</name> <name>Steven</name> </root> </x:XData> </XmlDataProvider> <DataTemplate x:Key="shmooga"> <TextBlock Text="{Binding}"/> </DataTemplate> </Window.Resources> <Grid> <ListBox ItemTemplate="{StaticResource shmooga}" ItemsSource="{Binding Source={StaticResource myXmlSource}, XPath=name}"> </ListBox> </Grid> </Window> Any help would be very much appreciated. Thanks!

    Read the article

  • How to refresh xmlDataProvider when xml document changes at runtime in WPF?

    - by Kajsa
    I am trying to make a image viewer/album creator in visual studio, wpf. The image paths for each album is stored in an xml document which i bind to to show the images from each album in a listbox. The problem is when i add a image or an album at runtime and write it to the xml document. I can't seem to make the bindings to the xml document update so they show the new images and albums aswell. Calling Refresh() on the XmlDataProvider doesn't change anything. I don't wish to redo the binding of the XmlDataProvider, just make it read from the same source again. XAML: ... <Grid.DataContext> <XmlDataProvider x:Name="Images" Source="Data/images.xml" XPath="/albums/album[@name='no album']/image" /> </Grid.DataContext> ... <Label Grid.Row="1" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Bottom" Padding="0" Margin="0,0,0,5" Content="{x:Static resx:Resource.AddImageLabel}"/> <TextBox Grid.Row="1" Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Name="newImagePath" Margin="0" /> <Button Grid.Row="1" Grid.Column="2" HorizontalAlignment="Left" VerticalAlignment="Bottom" Name="newImagePathButton" Content="{x:Static resx:Resource.BrowseImageButton}" Click="newImagePathButton_Click" /> ... <ListBox Grid.Column="0" Grid.ColumnSpan="4" Grid.Row="3" HorizontalAlignment="Stretch" Name="thumbnailList" VerticalAlignment="Bottom" IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding BindingGroupName=Images}" SelectedIndex="0" Background="#FFE0E0E0" Height="110"> ... Code behind: private void newImagePathButton_Click(object sender, RoutedEventArgs e) { string imagePath = newImagePath.Text; albumCreator.addImage(imagePath, null); //Reset import image elements to default newImagePath.Text = ""; //Refresh thumbnail listbox Images.Refresh(); Console.WriteLine("Image added!"); } public void addImage(string source, XmlElement parent) { if (parent == null) { //Use default album parent = (XmlElement)root.FirstChild; } //Create image element with source element within XmlElement newImage = xmlDoc.CreateElement(null, "image", null); XmlElement newSource = xmlDoc.CreateElement(null, "source", null); newSource.InnerText = source; newImage.AppendChild(newSource); //Add image element to parent parent.AppendChild(newImage); xmlDoc.Save(xmlFile); } Thank you very much for any help!

    Read the article

  • How should I architect my Model and Data Access layer objects in my website?

    - by Robin Winslow
    I've been tasked with designing Data layer for a website at work, and I am very interested in architecture of code for the best flexibility, maintainability and readability. I am generally acutely aware of the value in completely separating out my actual Models from the Data Access layer, so that the Models are completely naive when it comes to Data Access. And in this case it's particularly useful to do this as the Models may be built from the Database or may be built from a Soap web service. So it seems to me to make sense to have Factories in my data access layer which create Model objects. So here's what I have so far (in my made-up pseudocode): class DataAccess.ProductsFromXml extends DataAccess.ProductFactory {} class DataAccess.ProductsFromDatabase extends DataAccess.ProductFactory {} These then get used in the controller in a fashion similar to the following: var xmlProductCreator = DataAccess.ProductsFromXml(xmlDataProvider); var databaseProductCreator = DataAccess.ProductsFromXml(xmlDataProvider); // Returns array of Product model objects var XmlProducts = databaseProductCreator.Products(); // Returns array of Product model objects var DbProducts = xmlProductCreator.Products(); So my question is, is this a good structure for my Data Access layer? Is it a good idea to use a Factory for building my Model objects from the data? Do you think I've misunderstood something? And are there any general patterns I should read up on for how to write my data access objects to create my Model objects?

    Read the article

  • WPF: Is it possible to nest TreeView items with a binding expression?

    - by John Gietzen
    Lets say I have the following data: <XmlDataProvider x:Key="Values"> <x:XData> <folder name="C:"> <folder name="stuff" /> <folder name="things" /> <folder name="windows"> <folder name="system32" /> </folder> </folder> </x:XData> </XmlDataProvider> How can I get that into a treeview? I can't seem to grok hierarchical binding... I know that I can get it in there in C# code, but I wanted to do it with a binding expression.

    Read the article

  • help with grouping and sorting for TreeView in xaml

    - by danhotb
    I am having problems getting my head around grouping and sorting in xaml and hope someone can get me straightened out! I have creaed an xml file from a tree of files and folders (just like windows explorer) that can be serveral levels deep. I have bound a TreeView control to an xml datasource and it works great! It sorts everything alphabetically but ... I would like it to sort all folders first then all files, rather than folders listed with files, as it does now. the xml : if you load this to a treeviw it will display the two files before the folder because they are first in alpha-order. here is my code: <!-- This will contain the XML-data. --> <XmlDataProvider x:Key="xmlDP" XPath="*"> <x:XData> <Select_Project /> </x:XData> </XmlDataProvider> <!-- This HierarchicalDataTemplate will visualize all XML-nodes --> <HierarchicalDataTemplate DataType="project" ItemsSource ="{Binding}"> <TextBlock Text="{Binding XPath=@name}" /> </HierarchicalDataTemplate> <HierarchicalDataTemplate DataType="folder" ItemsSource ="{Binding}"> <TextBlock Text="{Binding XPath=@name}" /> </HierarchicalDataTemplate> <HierarchicalDataTemplate DataType="file" ItemsSource ="{Binding}"> <TextBlock Text="{Binding XPath=@name}" /> </HierarchicalDataTemplate> <CollectionViewSource x:Key="projectView" Source="{StaticResource xmlDP}"> <CollectionViewSource.SortDescriptions> <!-- ADD SORT DESCRIPTION HERE --> </CollectionViewSource.SortDescriptions> </CollectionViewSource> <TreeView Margin="11,79.992,18,19.089" Name="tvProject" BorderThickness="1" FontSize="12" FontFamily="Verdana"> <TreeViewItem ItemsSource="{Binding Source={StaticResource xmlDP}, XPath=*}" Header="Project"/> </TreeView>

    Read the article

  • Converting a WPFToolkit DataGrid from 1D list to 2D matrix

    - by user61073
    Hello - I am wondering if anyone has attempted the following or has an idea as to how to do it. I have a WPFToolkit DataGrid which is bound to an ObservableCollection of items. As such, the DataGrid is shown with as many rows in the ObservableCollection, and as many columns as I have defined in for the DataGrid. That all is good. What I now need is to provide another view of the same data, only, instead, the DataGrid is shown with as many cells in the ObservableCollection. So let's say, my ObservableCollection has 100 items in it. The original scenario showed the DataGrid with 100 rows and 1 column. In the modified scenario, I need to show it with 10 rows and 10 columns, where each cell shows the value that was in the original representation. In other words, I need to transform my 1D ObservableCollection to a 2D ObservableCollection and display it in the DataGrid. I know how to do that programmatically in the code behind, but can it be done in XAML? Let me simplify the problem a little, in case anybody can have a crack at this. The XAML below does the following: * Defines an XmlDataProvider just for dummy data * Creates a DataGrid with 10 columns o each column is a DataGridTemplateColumn using the same CellTemplate * The CellTemplate is a simple TextBlock bound to an XML element If you run the XAML below, you will find that the DataGrid ends up with 5 rows, one for each book, and 10 columns that have identical content (all showing the book titles). However, what I am trying to accomplish, albeit with a different data set, is that in this case, I would end up with one row, with each book title appearing in a single cell in row 1, occupying cells 0-4, and nothing in cells 5-9. Then, if I added more data and had 12 books in my XML data source, I would get row 1 completely filled (cells covering the first 10 titles) and row 2 would get the first 2 cells filled. Can my scenario be accomplished primarily in XAML, or should I resign myself to working in the code behind? Any guidance would greatly be appreciated. Thanks so much! <UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:custom="http://schemas.microsoft.com/wpf/2008/toolkit" mc:Ignorable="d" x:Name="UserControl" d:DesignWidth="600" d:DesignHeight="400" > <UserControl.Resources> <XmlDataProvider x:Key="InventoryData" XPath="Inventory/Books"> <x:XData> <Inventory xmlns=""> <Books> <Book ISBN="0-7356-0562-9" Stock="in" Number="9"> <Title>XML in Action</Title> <Summary>XML Web Technology</Summary> </Book> <Book ISBN="0-7356-1370-2" Stock="in" Number="8"> <Title>Programming Microsoft Windows With C#</Title> <Summary>C# Programming using the .NET Framework</Summary> </Book> <Book ISBN="0-7356-1288-9" Stock="out" Number="7"> <Title>Inside C#</Title> <Summary>C# Language Programming</Summary> </Book> <Book ISBN="0-7356-1377-X" Stock="in" Number="5"> <Title>Introducing Microsoft .NET</Title> <Summary>Overview of .NET Technology</Summary> </Book> <Book ISBN="0-7356-1448-2" Stock="out" Number="4"> <Title>Microsoft C# Language Specifications</Title> <Summary>The C# language definition</Summary> </Book> </Books> <CDs> <CD Stock="in" Number="3"> <Title>Classical Collection</Title> <Summary>Classical Music</Summary> </CD> <CD Stock="out" Number="9"> <Title>Jazz Collection</Title> <Summary>Jazz Music</Summary> </CD> </CDs> </Inventory> </x:XData> </XmlDataProvider> <DataTemplate x:Key="GridCellTemplate"> <TextBlock> <TextBlock.Text> <Binding XPath="Title"/> </TextBlock.Text> </TextBlock> </DataTemplate> </UserControl.Resources> <Grid x:Name="LayoutRoot"> <custom:DataGrid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsSynchronizedWithCurrentItem="True" Background="{DynamicResource WindowBackgroundBrush}" HeadersVisibility="All" RowDetailsVisibilityMode="Collapsed" SelectionUnit="CellOrRowHeader" CanUserResizeRows="False" GridLinesVisibility="None" RowHeaderWidth="35" AutoGenerateColumns="False" CanUserReorderColumns="False" CanUserSortColumns="False"> <custom:DataGrid.Columns> <custom:DataGridTemplateColumn CellTemplate="{StaticResource GridCellTemplate}" Header="01" /> <custom:DataGridTemplateColumn CellTemplate="{StaticResource GridCellTemplate}" Header="02" /> <custom:DataGridTemplateColumn CellTemplate="{StaticResource GridCellTemplate}" Header="03" /> <custom:DataGridTemplateColumn CellTemplate="{StaticResource GridCellTemplate}" Header="04" /> <custom:DataGridTemplateColumn CellTemplate="{StaticResource GridCellTemplate}" Header="05" /> <custom:DataGridTemplateColumn CellTemplate="{StaticResource GridCellTemplate}" Header="06" /> <custom:DataGridTemplateColumn CellTemplate="{StaticResource GridCellTemplate}" Header="07" /> <custom:DataGridTemplateColumn CellTemplate="{StaticResource GridCellTemplate}" Header="08" /> <custom:DataGridTemplateColumn CellTemplate="{StaticResource GridCellTemplate}" Header="09" /> <custom:DataGridTemplateColumn CellTemplate="{StaticResource GridCellTemplate}" Header="10" /> </custom:DataGrid.Columns> <custom:DataGrid.ItemsSource> <Binding Source="{StaticResource InventoryData}" XPath="Book"/> </custom:DataGrid.ItemsSource> </custom:DataGrid> </Grid>

    Read the article

  • Check if the path input is URL or Local File

    - by Ahmed
    Hi All, I'm working in xmldataprovider and we have configuration value "source" this value may be local file or url like c:\data\test.xml --absolute data\test.xml --relative or url http:\mysite\test.xml how I can determine all this cases in code I'm working c#

    Read the article

  • Binding Combobox to XML (wpf)

    - by mortor
    <EssenceList> <Essence GUID="464"> <Properties> <Property Name="Name"> <value>mt-1232-1. (1-1-3)</value> </Property> </Properties> <Characteristics> <Characteristic GUID="78"> <value>gadget</value> </Characteristic> <Characteristic GUID="79"> <value>measures</value> </Characteristic> </Characteristics> <LinkedEssences> <LinkType Type="ObjGroup"> <LinkedEssence GUID="369" /> </LinkType> <LinkType Type="ObjGroupProp" /> <LinkType Type="RoleObject"> <LinkedEssence GUID="5747"/> </LinkType> </LinkedEssences> </Essence> ... <Essence GUID="5747" Type="Role"> <Properties> <Property Name="Name"> <value>????-22</value> </Property> <Property Name="ShortName"> <value>UKPG-22</value> </Property> <Property Name="TagPrefix"> <value>UKPG22</value> </Property> <Property Name="useParentTagPrefix"> <value>0</value> </Property> </Properties> </Essence> ... <Essence GUID="5748" Type="Role"> </Essence> ... in example is a xml file with data from database. now i need to bind it to some fields... i use the XMLDataProvider here <Grid.DataContext> <XmlDataProvider x:Name="dataxml" XPath="EssenceList/Essence" Source="464.xml"/> </Grid.DataContext> and mostof simple texboxes i bind like <TextBox Text="{Binding XPath=/EssenceList/Essence/LinkedEssences/LinkType[1]/LinkedEssence/@GUID}" /> but now i need to bind a combobox this way: - the first Essence in the document contains LinkedEssences, that contains and - in document below there is a full description for it that contains the NAME property i need ????-22 UKPG22 0 and many other available Essences for this combobox i managed to bind the list of thems to combobox <ComboBox ItemTemplate="{StaticResource rolelistTemplate}" ItemsSource="{Binding XPath=/EssenceList/Essence[@Type]}" /> so it displays it well, but i can't bind it to my LinkedEssences.

    Read the article

  • Adding programatically a command to a listbox in WPF

    - by ajtp
    In my WPF application there is a listbox with items. The listbox is populated via a xmldataprovider from XAML and then binding it to Itemssource property of the listbox. Well, from XAML, I bind a comand to the listbox by doing: <ListBox.CommandBindings> <CommandBinding Command="{x:Static local:mainApp.MyCmd}" CanExecute="CanExecute" Executed ="Executed" /> </ListBox.CommandBindings> but I don't know how to programatically bind a command to each listboxitem. How to do it? Thanks in advance.

    Read the article

  • WPF Some styles not applied on DataTemplate controls

    - by Martin
    Hi, I am trying to learn something about WPF and I am quite amazed by its flexibility. However, I have hit a problem with Styles and DataTemplates, which is little bit confusing. I have defined below test page to play around a bit with styles etc and found that the Styles defined in <Page.Resources> for Border and TextBlock are not applied in the DataTemplate, but Style for ProgressBar defined in exactly the same way is applied. Source code (I just use Kaxaml and XamlPadX to view the result) <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Page.Resources> <Style TargetType="{x:Type Border}"> <Setter Property="Background" Value="SkyBlue"/> <Setter Property="BorderBrush" Value="Black"/> <Setter Property="BorderThickness" Value="2"/> <Setter Property="CornerRadius" Value="5"/> </Style> <Style TargetType="{x:Type TextBlock}"> <Setter Property="FontWeight" Value="Bold"/> </Style> <Style TargetType="{x:Type ProgressBar}"> <Setter Property="Height" Value="10"/> <Setter Property="Width" Value="100"/> <Setter Property="Foreground" Value="Red"/> </Style> <XmlDataProvider x:Key="TestData" XPath="/TestData"> <x:XData> <TestData xmlns=""> <TestElement> <Name>Item 1</Name> <Value>25</Value> </TestElement> <TestElement> <Name>Item 2</Name> <Value>50</Value> </TestElement> </TestData> </x:XData> </XmlDataProvider> <HierarchicalDataTemplate DataType="TestElement"> <Border Height="45" Width="120" Margin="5,5"> <StackPanel Orientation="Vertical" Margin="5,5" VerticalAlignment="Center" HorizontalAlignment="Center"> <TextBlock HorizontalAlignment="Center" Text="{Binding XPath=Name}"/> <ProgressBar Value="{Binding XPath=Value}"/> </StackPanel> </Border> </HierarchicalDataTemplate> </Page.Resources> <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center"> <StackPanel Orientation="Vertical" VerticalAlignment="Center"> <Border Height="45" Width="120" Margin="5,5"> <StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center"> <TextBlock HorizontalAlignment="Center" Text="Item 1"/> <ProgressBar Value="25"/> </StackPanel> </Border> <Border Height="45" Width="120" Margin="5,5"> <StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center"> <TextBlock HorizontalAlignment="Center" Text="Item 2"/> <ProgressBar Value="50"/> </StackPanel> </Border> </StackPanel> <ListBox Margin="10,10" Width="140" ItemsSource="{Binding Source={StaticResource TestData}, XPath=TestElement}"/> </StackPanel> </Page> I suspect it has something to do with default styles etc, but more puzzling is why some Styles are applied and some not. I cannot find an easy explanation for above anywhere and thus would like to ask if someone would be kind enough to explain this behaviour in lamens' terms with possible links to technical description, i.e. to MSDN or so. Thanks in advance for you support!

    Read the article

  • Is there a point to have multiple VS projects for an ASP.NET MVC application?

    - by mare
    I'm developing MVC application where I currently have 3 projects in solution. Core (it is supposed to be for Repositories, Business Classes, Models, HttpModules, HttpFilters, Settings, etc.) Data access (Data provider, for instance SqlDataProvider for working with SQL Server datastore - implements Repository interfaces, XmlDataProvider - also implements Repository interfaces but for local XML files as datastore) ASP.NET MVC project (all the typical stuff, UI, controllers, content, scripts, resources and helpers). I have no Models in my ASP.NET MVC project. I've just run into a problem because of that coz I want to use the new DataAnnotation feature in MVC 2 on my Bussiness class, which are, as said in Core, however I have I want to be able to localize the error messages. This where my problem starts. I cannot use my Resources from MVC project in Core. The MVC project references Core and it cannot be vice-versa. My options as I see them are: 1) Move Resources out but this would require correcting a whole bunch of Views and Controllers where I reference them, 2) Make a complete restructure of my app What are your thoughts on this? Also, Should I just move everything business related into Models folder in MVC project?? Does it even make any sense to have it structured like that, because we can just make subfolders for everything under MVC project? The whole Core library is not intended to ever be used for anything else, so there actually no point of compiling it to a separate DLL. Suggestions appreciated.

    Read the article

  • WPF RowDetailsTemplate width issue

    - by Ed Courtenay
    Apologies if this is a dupe, but I can't seem to find a rational solution for what must be a fairly simple issue. <Window x:Class="FeedTest.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Window.Resources> <XmlNamespaceMappingCollection x:Key="map"> <XmlNamespaceMapping Prefix="media" Uri="http://search.yahoo.com/mrss/" /> </XmlNamespaceMappingCollection> <XmlDataProvider x:Key="newsFeed" XPath="//item[string-length(title)>0]" Source="http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/uk/rss.xml" /> <DataTemplate x:Key="rowDetailTemplate"> <Border BorderThickness="2"> <StackPanel Orientation="Horizontal"> <Image Source="{Binding XPath=media:thumbnail/@url}" Width="66" Height="49" /> <StackPanel Orientation="Vertical" Margin="5"> <TextBlock Text="{Binding XPath=description}" TextWrapping="Wrap" /> </StackPanel> </StackPanel> </Border> </DataTemplate> <Style TargetType="{x:Type DataGrid}"> <Setter Property="GridLinesVisibility" Value="None" /> </Style> </Window.Resources> <Grid Binding.XmlNamespaceManager="{StaticResource map}"> <DataGrid AutoGenerateColumns="False" ItemsSource="{Binding Source={StaticResource newsFeed}}" RowDetailsVisibilityMode="VisibleWhenSelected" RowDetailsTemplate="{StaticResource rowDetailTemplate}"> <DataGrid.Columns> <DataGridTextColumn Header="Title" Binding="{Binding XPath=title}" MinWidth="150" Width="*" /> </DataGrid.Columns> </DataGrid> </Grid> The attached XAML gets a news feed, and displays the title of each item in a DataGrid. Selecting an item shows the RowDetailsTemplate which is where my problem lies - why does the RowDetailsTemplate expand beyond the width of the containing DataGrid (thus forcing a horizontal scrollbar), and more importantly, how do I stop it doing this? Many thanks.

    Read the article

1