|
To be honest, I'm not sure why you're dropping down to GDI to achieve this. There are ways to get the positions of windows that do not rely on dropping down to interop to retrieve these items. You can use the Visual tree and perform your calculations based off that.
|
|
|
|
|
because with visual tree I can handle only the windows that own to my application, but under the mouse cursor there may be a window of any application running on desktop.
|
|
|
|
|
Ah, I see. So you're evaluating ALL windows then.
Well, you're going to have to optimise your hit tests then I'm afraid.
|
|
|
|
|
I don't know how perform hit test without hiding my window...
|
|
|
|
|
Probably the easiest way to code this is to enumerate all the windows using EnumDesktopWindows[^]. You can use this to iterate over and do your point in rectangle tests. That way, you aren't relying on showing/hiding windows.
|
|
|
|
|
I use EnumWindows, the problem is that more than one windows pass the check(point in rect). How can I determine the right window on which lies the mouse?
|
|
|
|
|
I would guess the top most window (not counting your own).
|
|
|
|
|
Hi,
How is it possible to double click a selected row and be redirected to a separate page?
Thanks
|
|
|
|
|
A simple mechanism to handle to do this is to add an attached behaviour, as described here[^].
|
|
|
|
|
|
|
If you are using SL 5, you can use Click Count as described here[^].
|
|
|
|
|
Hi,
I am trying to populate a grid on the silverlight page:
as
follows:
...
...
grid.ItemsSource = e.Result.DetailedData;
Note that e.Result.DetailedData.count returns 13 records but on the above line I get the error:
can not implicitly convert type 'xweb.tservice.clsbt' to system.collections.ienumerable. An explicit conversion exists. (Are you missing a cast?)
It seems I have to do a cast but not sure how?
Any thoughts please?
Thanks
|
|
|
|
|
In wpf I put my ItemsSource="{Binding}" in XAML.
In code you then do : grid.ItemsSource = my_collection_of_some_sort;
hope this helps.
V.
|
|
|
|
|
the datagrid is set as AutoGenerateColumns="False"
And still get the same error as before but this time there is a blue underline instead of the previous red underline.
|
|
|
|
|
In XAML
<ListView Name="lv_countries" ItemsSource="{Binding}" SelectionChanged="lv_countries_SelectionChanged">
<ListView.View>
<GridView>
<GridViewColumn Header="Code" Width="Auto" DisplayMemberBinding="{Binding Path=Code}" />
<GridViewColumn Header="Country" Width="Auto" DisplayMemberBinding="{Binding Path=Name}" />
</GridView>
</ListView.View>
</ListView>
In code behind.
lv_countries.DataContext = countrylistresponse.CountryList;
where countrylistresponse.CountryList is an array of Country class. Country class has two properties: Code and Name (see XAML)
I'm not sure what kind of type e.Result.DetailedData is. You could try setting AutoGenerateColumns to "True" or define the columns in XAML.
PS: I know my sample is a ListView, but the principle is the same. Note however that WPF and Silverlight are slightly different. Could be that you have to call eg "DataBind()" method like you have to don in Aspx. I don't know. If VS gives you a blue bar under the statement it should tell you something when you hover over the statement...
hope this helps.
V.
|
|
|
|
|
For the record
In wpf I put my ItemsSource="{Binding}" in XAML.
In code you then do : grid.ItemsSource = my_collection_of_some_sort;
Should have been:
In wpf I put my ItemsSource="{Binding}" in XAML.
In code you then do : grid.DataContext = my_collection_of_some_sort;
Make sure that the e.Result.DetailedData is a collection like a List, Dictionary or an array.
Sorry about the confusion.
V.
|
|
|
|
|
Thank you
modified 30-Dec-11 17:17pm.
|
|
|
|
|
|
|
Hi @all,
i know that there a many articles about my problem but i cant find a solution.
I am new in WPF - MVVM and i try to understand the MVVM-Logic.
So i made a little project to understand that.
For my later apps i want to load UserControls dynamicly to my Window.
In my StartView i have a Binding to the StartViewModel.
(The Binding is in the APP.xaml)
StartView app = new StartView();
StartViewModel context = new StartViewModel();
the StartView
<Window x:Class="test.Views.StartView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:views="clr-namespace:test.ViewModel"
Title="Window1" Height="300" Width="516">
<Grid>
<Menu IsMainMenu="True" Margin="0,0,404,239">
<MenuItem Header="_Einstellungen">
<MenuItem Header="Server" />
</MenuItem>
</Menu>
<ContentControl Content="{Binding LoadedControl}" Margin="0,28,0,128" />
</Grid>
</Window>
the StartViewModel
namespace test.ViewModel
{
public class StartViewModel : ViewModelBase
{
#region Fields
private UCStastistikViewModel _loadedControl;
#endregion
public StartViewModel()
{
LoadedControl = new UCStastistikViewModel();
}
#region Properties / Commands
public UCStastistikViewModel LoadedControl
{
get { return _loadedControl; }
set
{
if (value == _loadedControl)
return;
_loadedControl = value;
OnPropertyChanged("LoadedControl");
}
}
#endregion
#region Methods
#endregion
}
}
UCStatistikView
<UserControl x:Class="test.Views.UCStatistik"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:vm="clr-namespace:test.ViewModel"
mc:Ignorable="d"
d:DesignHeight="188" d:DesignWidth="508">
<UserControl.DataContext>
<vm:UCStastistikViewModel />
</UserControl.DataContext>
<Grid Background="red">
</Grid>
</UserControl>
UCStatistikViewModel
namespace test.ViewModel
{
public class UCStastistikViewModel : ViewModelBase
{
#region Fields
#endregion
public UCStastistikViewModel()
{
}
#region Properties / Commands
#endregion
#region Methods
#endregion
}
}
Now i want to load my UCStatistikView in the ContentControl of my StartView.
But in the Startview only the Path test.UCStatistikViewModel is shown instead of the whole UC
Can anybody give me some Ideas to Fix it ?
Bye jogi
|
|
|
|
|
The standard way to display a usercontrol like this is to use a DataTemplate. Here's a simple data template that you could take and adapt as you need:
<DataTemplate DataType="{vm:UCStastistikViewModel}">
<view:UCStatistikView />
</DataTemplate>
|
|
|
|
|
hi
i am making a windows phone app which reads the text from the content file in project.How can we read the text of the content file into a text box .
Is there any way to bind the file with button and then read the file on click event?
Plz help
Thanks in advance
|
|
|
|
|
I need to implement payment process in silver light using ssl.
Anyone have idea on it?
|
|
|
|
|
saroja241 wrote: I need to implement payment process in silver light using ssl.
I believe, it's possible, however no one want to develop payment gateway in silverlight, since it's front end and reside on client computer. if you mean to say you want to get all information regarding client details and credit card through silvelight front-end, then that possible, you can call webservice to communicate to server about this information and based on what is returned, code your logic
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|