|
Maybe if I hadn't just rolled out of bed when I read the post I might have picked up on this. I really need to start getting more than 4 hours sleep.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
I added a wpf app to an existing solution, and without changing ANYTHING, I compiled it and tried to run it. I'm getting an error stating that the EXE file can't be found. Does anyone know what the hell I did to make this happen?
----------
I recreated the solution from scratch, and that seems to be the only way I could fix it. What a crock. During the discovery and resolution process, the IDE displayed an invisible modal dialog and refused to let me do anything - including closing the IDE - because the (invisible) dialog was waiting for input. I had to use task manager to close the IDE.
I hate Microsoft.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
modified on Friday, May 29, 2009 12:01 PM
|
|
|
|
|
I have a RichTextBox in my app, which is inside a control that is composed of a grid with 2 columnds,
i.e.
<Grid x:Name="LayoutRoot"
VerticalAlignment="Top" Height="Auto">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="150"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border x:Name="bdrLeft" Height="Auto"
Background="{DynamicResource SplitRichTextBoxRightSideBGBrush}"
BorderBrush="{DynamicResource SplitRichTextBoxRightSideBorderBrush}"
BorderThickness="1,1,0,1"
CornerRadius="3,0,0,3"
VerticalAlignment="Stretch">
<ContentPresenter x:Name="cpRightSide"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch"
Margin="0,0,0,0"
Width="Auto"
Height="Auto"
TextElement.Foreground="{DynamicResource SplitRichTextBoxLeftSideForegroundBrush}"/>
</Border>
<Border x:Name="bdrRight"
Height="Auto"
Grid.Column="1"
Background="{DynamicResource TextBoxBGBrush}"
BorderBrush="{DynamicResource TextBoxBorderBrush}"
BorderThickness="1,1,1,1"
CornerRadius="0,3,3,0"/>
<RichTextBox x:Name="rtbMain"
HorizontalAlignment="Center"
FontSize="{DynamicResource DefaultFontSize}"
Height="Auto"
BorderBrush="Transparent"
Background="Transparent"
Foreground="{DynamicResource DEFAULT_Font_Dark}"
VerticalAlignment="Center"
AcceptsReturn="False"
AcceptsTab="False"
Style="{DynamicResource ClearRichTextBoxStyle}"
Grid.Column="1"
Margin="0,3,0,3">
<localControl:EnabledFlowDocument x:Name="efdMainDocument" PageWidth="{Binding ElementName=rtbMain, Path=ActualWidth}"/>
</RichTextBox>
</Grid>
All the animations in the code are set to 00:00:00.00
However, when I add a UIElement or even text to the FlowDocument on startup, the text/uielement appear in the center of the flowdocument, then animate over to the left side where they should be. Is this a bug in WPF? I can't find anything in my code that would cause this.
|
|
|
|
|
Fixed:
Set the RichTextBox HorizontalAlignment to Stretch
|
|
|
|
|
Hi
Is there a way to populate a treeview using XML in WPF? Or by using the .xsd file?
If yes, please give me advice on how to get started. I've tried binding the treeview to the database using Hierarchical Datatemplates etc. but that still does not do the trick if you want multiple children nodes.
|
|
|
|
|
How about a short sample of the XML you're working with along with
how you're trying to bind to that XML...
Is the XML data actually hierarchical?
Also, searching on "wpf treeview xml data binding" yields tons of examples.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
The thing is, I don't have a XML structure yet, I'm using a typed dataset which was generated for me by adding a datasource via the Visual Studio wizard, so I first have to generate a XML file from my typed dataset, and then bind it to the treeview. Here's a sample of what it might look like though:
<?xml version="1.0" standalone="yes" ?>
- <NewDataSet>
- <Products>
<ProductID>1</ProductID>
<ProductName>Chai</ProductName>
<SupplierID>1</SupplierID>
<CategoryID>1</CategoryID>
<QuantityPerUnit>10 boxes x 20 bags</QuantityPerUnit>
<UnitPrice>18</UnitPrice>
<UnitsInStock>39</UnitsInStock>
<UnitsOnOrder>0</UnitsOnOrder>
<ReorderLevel>10</ReorderLevel>
<Discontinued>false</Discontinued>
</Products>
- <Products>
<ProductID>2</ProductID>
<ProductName>Chang</ProductName>
<SupplierID>1</SupplierID>
<CategoryID>1</CategoryID>
<QuantityPerUnit>24 - 12 oz bottles</QuantityPerUnit>
<UnitPrice>19</UnitPrice>
<UnitsInStock>17</UnitsInStock>
<UnitsOnOrder>40</UnitsOnOrder>
<ReorderLevel>25</ReorderLevel>
<Discontinued>false</Discontinued>
</Products>
</NewDataSet>
This is obviously just a basic table showing some Products, the database I'm going to be using will have sub levels as well e.g. A Product(above) can have multple Parts assoiciated with it, so that needs to be shown within Product and for each Product
|
|
|
|
|
What I also want to know, is say for instance you have 2 tables; Categories and Products. And the relationship between them is one-to-many (A category can have many products). Is it possible to generate an XML file showing all the different categories as well as the products belonging to them hierarchically?
<Category id=1><br />
<Product id=1><br />
<name>milk</name><br />
<description>white</description><br />
<price>3.00</price><br />
<Product id=2><br />
<name>cola&/name><br />
<description>black&/description><br />
<price>3.00&/price><br />
<Category id=2><br />
<Category id=3>
|
|
|
|
|
The UI part is relatively easy - here's an example (not I've added some
Parts to the Products so there would be some hierarchical data):
<Window x:Class="WPFTester.Window2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window2" Width="300" Height="250" >
<Window.Resources>
<XmlDataProvider x:Key="ProductData" XPath="*">
<x:XData>
<NewDataSet xmlns="" >
<Products>
<ProductID>1</ProductID>
<ProductName>Chai</ProductName>
<SupplierID>1</SupplierID>
<CategoryID>1</CategoryID>
<QuantityPerUnit>10 boxes x 20 bags</QuantityPerUnit>
<UnitPrice>18</UnitPrice>
<UnitsInStock>39</UnitsInStock>
<UnitsOnOrder>0</UnitsOnOrder>
<ReorderLevel>10</ReorderLevel>
<Discontinued>false</Discontinued>
<Parts>
<PartName>Part 1</PartName>
</Parts>
<Parts>
<PartName>Part 2</PartName>
</Parts>
<Parts>
<PartName>Part 3</PartName>
</Parts>
</Products>
<Products>
<ProductID>2</ProductID>
<ProductName>Chang</ProductName>
<SupplierID>1</SupplierID>
<CategoryID>1</CategoryID>
<QuantityPerUnit>24 - 12 oz bottles</QuantityPerUnit>
<UnitPrice>19</UnitPrice>
<UnitsInStock>17</UnitsInStock>
<UnitsOnOrder>40</UnitsOnOrder>
<ReorderLevel>25</ReorderLevel>
<Discontinued>false</Discontinued>
<Parts>
<PartName>Part 1</PartName>
</Parts>
<Parts>
<PartName>Part 2</PartName>
</Parts>
<Parts>
<PartName>Part 3</PartName>
</Parts>
</Products>
</NewDataSet>
</x:XData>
</XmlDataProvider>
<HierarchicalDataTemplate DataType="Products" ItemsSource="{Binding XPath=Parts}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding XPath=ProductID}" Margin="0,0,6,0" />
<TextBlock Text="{Binding XPath=ProductName}" />
</StackPanel>
</HierarchicalDataTemplate>
<DataTemplate DataType="Parts" >
<TextBlock Text="{Binding XPath=PartName}" />
</DataTemplate>
</Window.Resources>
<Grid >
<TreeView ItemsSource="{Binding Source={StaticResource ProductData}, XPath=*}" />
</Grid>
</Window>
In real life your XML data is dynamic, but you can bind to dynamically created XML,
for example: How to: Bind to XDocument, XElement, or LINQ for XML Query Results[^]
Creating the XML is outside the scope of this message board, but if you're
relatively new at it, I'd really recommend learning a bit of LINQ.
Using LINQ to XML and possibly LINQ to Dataset you'll have a consistent way to work with
both Dataset and XML data. For example, you can use LINQ to query a multi-table
dataset and build a hierarchical XML representation for presentation.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks I will have a look at LINQ. That sounds like it might do the trick.
So I guess there is no easy way to create a hierarchical XML structure based on a multi-table dataset. I though there might have been.
|
|
|
|
|
I just found out that when you're using untyped datasets, then you can manually set up a relation between your tables, and then you just set the Relation's Nested property to true, then when you generate an XML file it creates a beautiful hierarchical structure, just the way I want it.
BUT, I'm using a typed dataset, which means the relations are created for me. Is there a way to manually edit these relations?
|
|
|
|
|
I'm trying to hook the ReadFile API like FileMon does.
Do you have an example of ReadFile?
Please help me .....
|
|
|
|
|
You could always use this[^]. Your question has nothing to do with WPF, WCF or WF. In future, please take questions like this to a more appropriate forum.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
|
That's nice. I give you an answer and you give abuse. Tell me, which part of my answer actually offended you - the bit where I pointed you at actual code samples, or the bit where I pointed out that there were better places to ask these questions?
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Don't react to quickly Pete. "maa chuda" is actually a South Glaswegian variant of the phrase "my chum" which means literally "he who is a friend of me". Used in this context the speaker is welcoming you into his inner circle of friends and thanking you for your help.
The believe traditional response is "och I"
I can see how that might have confused you.
Simon
|
|
|
|
|
Simon Stevens wrote: Used in this context the speaker is welcoming you into his inner circle of friends and thanking you for your help.
There are only certain people who have an inner circle that interests me.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
No one can abuse the great Pete!
|
|
|
|
|
Hi Pete,
I am sorry. I was really upset and I don't know wht really makes me to reply so badly.I am greatfull that u helped me.
I hope u will forgive me with a SMILE on ur face
|
|
|
|
|
Consider it done. No harm, no foul.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
*marked as offensive*
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I am working on a WPF RSS feeds application. In this I want to display the RSS feed videos in the WPF page itself i.e., no external media player should open to play the RSS videos. How can I do this.
If any one have any idea to do this please reply.
Thanks in advance.
|
|
|
|
|
Hi All,
Has anyone encountered and worked around this problem?
I have a WPF app that uses the MediaPlayer class to get hold of WMP to play audio files. All is fine for a while playing various files then bang I get this error:
Unhandled exception at 0x1d1c1b30 in App.exe: 0xC0000005: Access violation writing location 0x3d0c3360.
I've wrapped all the neccessary bits in try{} / catch{} to isolate the issues but I fear it's actually out of my hands and may even be a bug in WPF or the MediaPlayer class itself.
I'm also attaching to the media player class MediaFailed event and that isn't getting fired when the error occurs.
Cheers,
|
|
|
|
|
Jammer wrote: playing various files
I thought I heard somewhere it was recommended to create a new media element/player for each file
because of some issue.
Or did I dream it...
*shrug*
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hey Mark,
This may well be the case, It's all good for probably nearly 100 plays, then bang!
Hmm ... I may have to just start creating a new one after every 30 or so and see if that fixes the issue.
All far from good, but a solution nonetheless.
Cheers Chap,
|
|
|
|