|
ProgrammerWPF wrote: if it was a normal list, it was simple
An enum can be treated like a "normal" list, Enum.GetNames[^] returns an array of the enum names. Enum.GetValues[^] returns an array values. You can either use one of these methods or create a collection that combines them into name/value pairs and bind your dropdown to it.
only two letters away from being an asset
|
|
|
|
|
If you need to bind to an enumeration, you can find details here[^].
"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
|
|
|
|
|
Hi guys
I use the following code (binding-a-treeview-to-a-dataset/[^]) to bind my treeview to a dataset:
<objectdataprovider x:key="dataSetProvider" methodname="GetRangeProductsDataSet" objecttype="{x:Type local:DataSetCreator}">
<DataTemplate x:Key="RangeDetailTemplate">
<TextBlock Text="{Binding Product}"/>
</DataTemplate>
<HierarchicalDataTemplate x:Key="RangesTemplate" ItemsSource="{Binding RangeProducts}" ItemTemplate="{StaticResource RangeDetailTemplate}">
<TextBlock Text="{Binding ProductRangeDesc}"/>
</HierarchicalDataTemplate>
<TreeView DataContext="{StaticResource dataSetProvider}" ItemsSource="{Binding ProductRange}" ItemTemplate="{StaticResource RangesTemplate}"
Margin="143.75,2.723,8,36" Name="treeViewRangeStartup"
Background="Transparent"></TreeView>"
Then it gives me some error saying that the path to my database does not exist, and it won't load the designer. When I run the app though, it works fine, showing me all the nodes as well as all extending tree nodes. There can'be something wrong with my connectionstring because I didn't change it. And before I used a dataset to bind to a treeview, I used an XML file to bind to bind to the treeview. This gave me no errors even though I was using exactly the same database with exactly the same connection string etc.
Any hints to what might cause this?
modified on Monday, August 31, 2009 1:38 PM
|
|
|
|
|
Also note, the database I'm using resides in a folder within my solution directory, so I'm not accessing a database on a server whatsoever.
In the error list it displays a certain database path, and it says that this path is incorrect, but nowhere in my path did I specify this path. The folder names are correct though, but the directory that the error message displays is exactly 2 folders back from where my database actually is
|
|
|
|
|
Hi,
I am working on a silverlight application. In this I need to upload images and save them in the database.
If anyone have any idea to solve this please reply me.
Thanks in advance
|
|
|
|
|
I found a nice Example[^] here... Hope it helps..
|
|
|
|
|
Hello to all
I can't access the visual éléments of a wpf listbox
I'm trying to find the scrollviewer but impossible...
Here is the bit of code:
Dim i As Integer
Dim child As Object
For i = 0 To i <= VisualTreeHelper.GetChildrenCount(monListBox)
child = VisualTreeHelper.GetChild(monListBox, i)
If TypeOf (child) Is ScrollViewer Then
SV_ShowCalendarPanel = child
End If
Next
The trouble is that "VisualTreeHelper.GetChildrenCount(monListBox)" get me O all the time,
and then, of course, the "GetChild" get me... nothing
All help will be welcome,
Yann.
|
|
|
|
|
Your logic isn't correct here. The child of a Listbox is a border, so you need to keep enumerating through the child visuals using a recursive method. This is an example piece of code which gets the ScrollViewer (in C# I'm afraid):
public ScrollViewer FindScrollViewer(Visual myVisual)
{
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(myVisual); i++)
{
Visual child = (Visual)VisualTreeHelper.GetChild(myVisual, i);
if (child is ScrollViewer)
{
return child as ScrollViewer;
}
return FindScrollViewer(child);
}
return null;
} All you need do to call it is SV_ShowCalendarPanel = FindScrollViewer(monListBox);
"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
|
|
|
|
|
Hello Pete,
Thanks for you answer.
Fidling around I finaly arrived at the same solution by myself.
By the way, I'm a big fan of your post...
Yann.
|
|
|
|
|
pkboo wrote: By the way, I'm a big fan of your post...
Thanks - it's always nice to know that people find what I write helpful.
pkboo wrote: Fidling around I finaly arrived at the same solution by myself.
Cool - you know you're getting better at WPF when you can sort things like this out.
"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'm new to WPF and I'm having a bit of trouble figuring out images. I'm trying to load image files (png,gif,bmp,etc) from the hard drive, then allow pixel manipulation (changing the color and alpha) and saving them off again.
I know there are a lot of options for holding images; BitmapSource, Image, BitmapFrame... I just don't know what is best for what I'm working on! Any suggestions? And how would I get at the pixels to change them?
Thanks!
|
|
|
|
|
I've noticed something a bit annoying with wpf. If i spawn a window, and the monitor is sleeping, then my window doesn't get painted until you invalidate it by moving your mouse around it... clicking at it... or resizing it...
I've made a proof of concept vs.net solution to illustrate what i'm encountering: http://wolfsfiles.googlepages.com/SleepingMonitorWpfProblem.zip[^]
|
|
|
|
|
|
I embedded a ListBox in a DataGrid for displaying a List<string> in a GridCell. And I need to popup a ComboBox to select my data in the GridCell. The ComboBox is customied for multiple selection. However, when I click the cell (with ListBox embedded), the ComboBox can’t be activated. Here is the codesnip. Do I miss something? Or is the ListBox sucked in the mouse event from the DataGrid? TIA.
<br />
<data:DataGridTemplateColumn Header="Test"><br />
<data:DataGridTemplateColumn.CellTemplate><br />
<DataTemplate><br />
<controls1:DockPanel><br />
<ListBox controls1:DockPanel.Dock="Left" <br />
ItemsSource="{Binding TestNames}" VerticalAlignment="Center" /><br />
</controls1:DockPanel><br />
</DataTemplate><br />
</data:DataGridTemplateColumn.CellTemplate><br />
<data:DataGridTemplateColumn.CellEditingTemplate><br />
<DataTemplate><br />
<StackPanel Orientation="Vertical"><br />
<c:DataGridComboBox SelectedItem="{Binding TestInfo, Mode=TwoWay}" <br />
Style="{StaticResource MultiSelectComboBoxStyle}"<br />
DropDownOpened="DataGridComboBox_DropDownOpened"<br />
DisplayMemberPath="Name" <br />
c:DataGridComboBoxService.ForceOpen="true" Height="24" /><br />
</StackPanel><br />
</DataTemplate><br />
</data:DataGridTemplateColumn.CellEditingTemplate><br />
</data:DataGridTemplateColumn><br />
|
|
|
|
|
Just a thought, it it worth trying to catch the list box click event in code-behind and then displaying the combo box in this event's code?
|
|
|
|
|
Hi peoples,
previously i have created one application in win forms in .net frame work 3.5.
now i need to convert the same to web based application , may be using WPF.
can any one let me know is it possible to do that?
|
|
|
|
|
Hema Bairavan wrote: can any one let me know is it possible to do that?
It really depends on your skill as a programmer.
"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
|
|
|
|
|
Hi,
I spent some time searching for an answer to this problem. While there are a fair number of postings on this error message, none of the solutions worked for me. Happily, I did figure out what was going wrong, and found a workaround. I'm posting the solution so that people who have the same problem in the future can find this and save themselves some time.
I had a user control of a grid of labels. In code, I was assigning one control's Content property to another, which worked fine for all the labels -- except one. For that label, I got an error message: "specified element is already the logical child of another element. disconnect it first." I'm quite new to Silverlight and didn't find the message too enlightening.
Label's content can be a simple string, or it can be a Run(); All the labels that worked happened to have strings, but the one that didn't had a Run(). I took that as a big fat hint. I tried writing a method that created a new Run and copied the relevant fields, and it worked; with this new Run() I can make assignments without errors.
Hope this helps some suffering dev in the future.
P.
|
|
|
|
|
That can be explained in a simple way.
Label is derived from ContentControl, which means it can contain other controls inside it aside from Run and text string.
In the case you are describing the Run element is a child control of Label and Silverlight does not allow a child control to have more than one parent.
My recommendation is if you are working with simple strings only you should stick with TextBlock, and if the string is complex you have to go through the TextBlock.InlineCollection to get all the Run and LineBreak elements.
Cheers,
Edbert
Sydney, Australia
|
|
|
|
|
Hi all,
Let me know where i am missing. No exceptions or errors thrown, but video not playing. But when i point the uri to local wmv file it plays correctly.
Thank you,
Sahridhayan
try
{
HttpWebRequest request = WebRequest.Create("http://silverlight.services.live.com/74017/PrajaRajyam/video.wmv") as HttpWebRequest;
request.ContentType =
"text/xml";
request.CookieContainer =
new CookieContainer();
// Assign the credentials of the logged in user or the user being impersonated.
request.Proxy = System.Net.
WebProxy.GetDefaultProxy();
request.Proxy.Credentials =
new NetworkCredential("user", "pwd", "domain");
request.Credentials =
new NetworkCredential("user", "pwd", "domain");//System.Net.WebProxy.GetDefaultProxy().Credentials;
XmlDocument doc = new XmlDocument();
request.GetResponse();
mediaTimeline.Source =
new Uri(@"http://msbluelight-0.agappdom.net/e1/d/74017/13425844.a/63385804800/0.9BjdDlJ_gKpT8Qt8glP0frw2kMA/video.wmv", UriKind.Absolute);
//new Uri(@"mms://mschnlnine.wmod.llnwd.net/a1809/d1/ch9/2/3/3/1/2/4/DynamicsDuoCRMWPF_s_ch9.wmv");
}
|
|
|
|
|
I am doing R&D right now on WPF App and WPF Browser app. The WPF App is a desktop app and and WPF Browser app is an online app. Is there anyway to have the WPF App project run on the Internet just like the WPF Browser app? I am trying to create an application that when run locally, it will be a desktop application and then remotely, it will have the same interface and functionality. We are trying not to have seperate projects and redundant source code.
Thanks in advance.
|
|
|
|
|
VS => New Project => WPF Browser Application.
However this is called a XBAP application and requires the full framework on the target computer
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
Would the XBAP application run like a desktop application locally or would I need a WPF Application?
|
|
|
|
|
The real question to me is why have two versions at all? If the remote version has the same interface and functionality as the local version, there is no need to have two versions. If by 'remote' you mean from the internal network, you could just put the exe file on a network share and allow people to run it from there (which will give you only one place to update it). With .NET 3.5SP1 (or appropriate security configurations), the program will run the same from a network share as it does from the local computer.
|
|
|
|
|
What I meant by remote is someone can be in New York and connect to the application through the Internet(provided they have access permission) which is hosted in California. I really don't want to have two seperate application that does the same thing. I need an application that can be run on a local computer (desktop application) and over the internet. What would be the best way to go, considering I will have unmanaged and managed code at the back-end.
|
|
|
|