|
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.
|
|
|
|
|
Hey people
Is there a way to programmatically show a ToolTip without hovering the mouse over a certain element?
I want to use this to draw the user's attention to certain areas at certain times.
Also, can I customize a ToolTip so that it looks like a MS Word Callout symbol/Chat balloon?
|
|
|
|
|
Showing a tooltip is not a good idea because it has a specific meaning to users, i.e. when you move over an item, it displays information. What I would suggest instead, is to use the AdornerLayer to display this information - which has the added advantage of you being able to style it however you want.
"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 this is sarath chandra.
I am very much new to wpf.
I have task to prepare a time sheet for media schedule.
In that i have to apply differnt background color to cells in datagrid depending on the condition.
Here no of rows and columns will change depends on the condition.
Can any body give solution for this task.
Thanks and Regards
Sarath Chandra
|
|
|
|
|
You will have to add Resource Dictionary say "DataGridStyle.xaml"
<pre><ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:toolkit="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit"
xmlns:Primitives="clr-namespace:Microsoft.Windows.Controls.Primitives;assembly=WPFToolkit">
//Set the styles here
<Style x:Key="DatagridCellStyle" TargetType="toolkit:DataGridCell">
<Setter Property="Background" Value="White" />
<Setter Property="Foreground" Value="Black" />
<Setter Property="BorderBrush" Value="Blue" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Background" Value="LightGray" />
</Trigger>
<Trigger Property="IsSelected" Value="true">
<Setter Property="Background" Value="Blue" />
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary></pre>
In App.xaml file
Add the resources
<pre><Application x:Class="ApplicationName" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="DataGridStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application></pre>
In your datagrid markup
add attribute
cellstyle = "{StaticResource DatagridCellStyle}"
I hope that helps,
Vsaratkar
|
|
|
|
|
I'm using a cascading dropdownlist using three tables. the code below works fine if my primary keys are numeric(integer) but my business rules want the primary keys to be alphernumeric(string).
[WebMethod]
public CascadingDropDownNameValue[] GetColors(string knownCategoryValues, string category)
{
StringDictionary kv = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);
int colorId;
if (!kv.ContainsKey("Model") || !Int32.TryParse(kv["Model"],out colorId))
{
return null;
}
dsModelColorsTableAdapters.ModelColorsTableAdapter adapter = new dsModelColorsTableAdapters.ModelColorsTableAdapter();
dsModelColors.ModelColorsDataTable colors = adapter.GetColorsByModelId(colorId);
List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();
foreach (DataRow dr in colors)
{
values.Add(new CascadingDropDownNameValue((string)dr["ColorName"], dr["ColorID"].ToString()));
}
return values.ToArray();
}
How do I use my string primary key using the above code?
Please help an ajax technology adict.
ML Lingwati
|
|
|
|