|
i want to find out row number of a datagrid when i move mouse on it i.e. without clicking any row it must return the row number.
Tilak raheja
|
|
|
|
|
A quick look at the documentation[^] suggests the CellEnter and CellLeave events will give you what you need.
Programming is work, it isn't finger painting. Luc Pattyn
|
|
|
|
|
Hi,
I am trying to create stack bart chart in silver light with bars should come in horizental direction by following code
SeriesDefinition tempSeriesForSale1 = new SeriesDefinition();
tempSeriesForSale1.ItemsSource = saleUnits1;
tempSeriesForSale1.IndependentValuePath = "SalesDistrict";
tempSeriesForSale1.DependentValuePath = "saleFromOldCustomer";
//tempSeriesForSale1.Title = "Tik tik";
stackSeriesForSale.SeriesDefinitions.Add(tempSeriesForSale1);
Chart3.Series.Add(stackSeriesForSale);
With this code bars are coming in vertical direction. If I Interchange the Independentvaluepath and dependentvalue path then I gets exception.
Following is the code in .xaml file
<toolkit:Chart Name="Chart3" Title="Repeat Sales" VerticalAlignment="Top" Margin="33,330,176,0"
Height="262">
<toolkit:PieSeries ItemsSource="{Binding}" IndependentValuePath="Name"
DependentValuePath="Types" IsSelectionEnabled="True" >
</toolkit:PieSeries>
</toolkit:Chart>
Can someone please help?
Regards,
Vishal
|
|
|
|
|
[UPDATE] Got it working
I want to style a tooltip so that it looks like a Facebook tooltip[^].
In this design, there can be images, text, links, and buttons, as well as a little triangular pointer. So that leaves a couple of questions...
1) I was thinking that having multiple content presenters would allow me to define the style, and then when it's applied, set the image, text, links, etc. How do you set up multiple content presenters?
2) The triangular pointer... How do you get this to point to the correct spot depending on where the tooltip opens.
Thanks
K
If it's not broken, fix it until it is
|
|
|
|
|
Hi
I am basically trying to create a control that consists of a combobox and some buttons (add, clear etc). I realise I could do it by creating a usercontrol with some codebehind, but I am trying to achieve this by defining a custom control class and a style for the control.
I have done the below based on other custom controls I have done, but the issue I am having is that the ItemsSource is always null and never gets set.
[TemplatePart(Name = ComboBoxControl.INPUTCOMBOBOX_NAME, Type = typeof(ComboBox))]
public class ComboBoxControl : Control
{
#region Constants
const String CATEGORY_NAME = "Custom ComboBox Control";
const String INPUTCOMBOBOX_NAME = "PART_InputComboBox";
#endregion
#region Properties
ComboBox _inputComboBox;
#endregion
#region Dependency Properties
public static readonly DependencyProperty DisplayMemberPathProperty =
DependencyProperty.Register("DisplayMemberPath", typeof(string), typeof(ComboBoxControl), new UIPropertyMetadata(String.Empty));
public static readonly DependencyProperty ItemsSourceProperty =
DependencyProperty.Register("ItemsSource", typeof(IEnumerable), typeof(ComboBoxControl), new UIPropertyMetadata());
#endregion
#region Dependency Public Properties
public string DisplayMemberPath
{
get { return (string)GetValue(DisplayMemberPathProperty); }
set { SetValue(DisplayMemberPathProperty, value); }
}
public object ItemsSource
{
get { return (System.Collections.IEnumerable)GetValue(ItemsSourceProperty); }
set { SetValue(ItemsSourceProperty, value); }
}
#endregion
#region Constructor
public ComboBoxControl() { }
static ComboBoxControl()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(ComboBoxControl), new FrameworkPropertyMetadata(typeof(ComboBoxControl)));
}
#endregion
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
_inputComboBox = (ComboBox)GetTemplateChild(INPUTCOMBOBOX_NAME);
}
}
And the following style:
<Style TargetType="{x:Type local:ComboBoxControl}">
<Setter Property="Label" Value=""/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:ComboBoxControl}">
<Border>
<DockPanel>
<ComboBox x:Name="PART_InputComboBox" VerticalAlignment="Stretch" MinHeight="30"
DisplayMemberPath="{TemplateBinding DisplayMemberPath}"
ItemsSource="{Binding Path=ItemsSource, Mode=TwoWay, RelativeSource={RelativeSource Mode=FindAncestor,
AncestorType={x:Type local:ComboBoxControl}}, UpdateSourceTrigger=PropertyChanged}"/>
</DockPanel>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
NOTE: I have omitted irrelevant code.
And trying to set it like this:
<ctl:ComboBoxControl ItemsSource="{Binding Path=Users, Mode=TwoWay}"/>
But the value of the combobox itemsource is always null?!
Can anyone help please?
Thanks
|
|
|
|
|
Ok, I think I may have solved this, but if what I put below isn't the real solution, please let me know.
Where I was setting:
<ctl:ComboBoxControl ItemsSource="{Binding Path=Users, Mode=TwoWay}"/>
I hadn't set the datacontext of the control the combobox was being hosted in. i.e. DataContext = this;
|
|
|
|
|
If you haven't set a DataContext , then your binding would fail here so it would seem fair to say that you found your issue.
|
|
|
|
|
Thanks for confirming Pete.
|
|
|
|
|
Hi all , i'm working on wpf application currently, i doing face detection using microsoft kinect for that i want an ANIMATION during face scanning period.
it should be like one line keep animation on the face square just like xerox machin's laser lightfrom top to bottem.
Thanks in advance..
|
|
|
|
|
Hi!
What is the namespace to include for ShellExecute to compile?
I've to open a URL from WPF Emulator. How to do this? I tried <pre lang="c++">Process.Start()</pre>
But it opens many times. ShellExecute() doesn't compile.
It gives the following error:
The name 'ShellExecute' does not exist in the current context
How to open a URL in WPF?
|
|
|
|
|
I just use Process.Start to open a URL. Here's an example from the code I'm looking at right now:
public static void OpenUrl(string url)
{
if (string.IsNullOrWhitespace(url))
throw new ArgumentNullException("url");
Process.Start(url);
}
|
|
|
|
|
Pete O'Hanlon wrote:
Process.Start(url);
I've used this. It's opening the URL many times. I want only one time. How to do this? What about ShellExecute with WPF?
|
|
|
|
|
It only opens it once per execution - sounds like you're hooked into calling that many times - and you would have to write interop code for ShellExecute , where you'd still get the same issue. Put a breakpoint on your Process.Start code and see how many times it's being called.
|
|
|
|
|
Hi!
I've to change the state of the application to minimized before opening the URL.
I'm using this code.
<pre lang="c#">
#if WINDOWS
this.WindowState = WindowState.Minimized;
#endif
</pre>
But it shows the following error:
The name 'WindowState' does not exist in the current context
How to minimze the application before opening the URL?
|
|
|
|
|
You may need to use the FormWindowState enumeration as described here[^].
Programming is work, it isn't finger painting. Luc Pattyn
|
|
|
|
|
I don't think that's the problem - this error would indicate he's trying to use the minimize function from a piece of none-window code.
|
|
|
|
|
I Agree; it's actually not clear which of the references is out of context.
Programming is work, it isn't finger painting. Luc Pattyn
|
|
|
|
|
I assume you're not trying this from the main window (or from the code of any window in your application) then. To minimize the main window from another location, try:
App.Current.MainWindow.WindowState = System.Windows.WindowState.Minimized
|
|
|
|
|
Hi,
In VS 2010, when i try to publish i am getting all the files including .cs pages, which contain c# codes, project file etc. I need only the required files for publish.
When i build using Release mode, it does not create all files.
How can i publish as like done in VS2009.
Thankyou,
YP
|
|
|
|
|
Right click on 'MyProject.Web' project and click publish. There select
Publish method- File System
Target Location - Path
Select delete all existing files prior to publish.
Now click publish. It will create .xap file for your silverlight project.
Manoj Kumar
|
|
|
|
|
hi guy's
i have code in c# windows form i want to view it form in emulator in WP7 when run this program .... i ask it allow and how to view form in c# view it in another program (emulator wp7 ) plz?
|
|
|
|
|
You can't view a Windows Form in the WP7 emulator. The emulator is targetted specifically at the Silverlight runtime that Windows Phone uses, which uses a very specialist version of the .NET runtime.
|
|
|
|
|
okey thnx
|
|
|
|
|
Hi,
i have 2 tabitem, each one cotain a wpf gdatagrid
i want to pass data from grid1 in tabitem1 to grid2 in tabintem2
when i click on tab item2 or on boutton.
i tried this code but i get exception:
L'élément possède déjà un parent logique. Il doit être détaché de l'ancien parent avant d'être attaché au nouveau.
private void btnValidate_Click(object sender, RoutedEventArgs e)
{
for (int j = 0; j < i - 1; j++)
{
TextBlock x = dgrecep.Columns[0].GetCellContent(dgrecep.Items[j]) as TextBlock;
if (x != null)
{
if (v.validate(x.Text))
{
dgrecep2.Items.Add(dgrecep.Columns[0].GetCellContent(dgrecep.Items[j]));
}
else
{
MessageBox.Show("non valide");
}
|
|
|
|
|
Why on earth are you doing this via code behind? You really need to read up on MVVM, and judging by the number of questions you have posted in this forum, I would suggest that you need to read a basic book on WPF, such as Adam Nathan's excellent WPF Unleashed.
|
|
|
|