|
To learn about DataGrid, I suggest looking at "WPF DataGrid Practical Examples" [^]. To respond to the F9 key I expect you can use the KeyDown event, but I have not tried this.
To handle such events in a MVVM pattern - that is tricky and not something I have solved. So far I have taken the easy path and simply used codebehind. I suspect the answer might be in "WPF : If Heineken did MVVM Frameworks Part 2 of n" [^] - View Lifecycle Events - but I have not yet properly followed this or tried it.
I hope that might be helpful.
Tim
|
|
|
|
|
Hi,
I have a WPF custom control. Its a container control derived from system.Windows.controls.Grid.
My requirement is only one control should be there in a cell of Grid.
I want to delete a control say Button, when the user drags & drops it on my custom control's cell & that cell already contains a control in it. I want to delete the control automatically & also the XAML should be updated for the same(XAML entry for the control should also be removed).
Currently what I am doing is in my Custom container's ArrangeOverride Method(), I am deleting the child control but the XAML is not updated for the same. I mean when the control is dragged on a cell with already having a control, control doen't appear in UI(as the code in ArrangeOverride deletes it from child collection ) but the XAML entry for the control is still present in xaml.
should I use any AdonerProvider or TaskProvider fotr this. If so how?
Thanks in Advance,
Vinod C S
modified on Thursday, October 22, 2009 5:18 AM
|
|
|
|
|
I have posted the following question on codeplex, but not had any reply. I am hoping someone here may be able to help.
I have a WPF DataGrid which represents a small number of options (ie one option per row), one of which is chosen as the default. In the first column of the DataGrid I want to have a RadioButton in each row - to set the default. I have almost got this to work with the code below - the Binding is working. The problem is, it is possible to get into a scenario where the setting from the RadioButton is lost.
Our underlying object being bound to implements IEditableObject and we use this in various way to check edits and also take action when the default is changed. I have found that clicking the RadioButton completely bypasses the BeginEdit / EndEdit process of the DataGrid.
The xaml is as follows:
<toolkit:DataGrid Name="dgTesters" AutoGenerateColumns="False" AlternationCount="2" ItemsSource="{Binding LocalTesters}"
CanUserAddRows="false" CanUserDeleteRows="False"
SelectionMode="Single"
RowEditEnding="dgTesters_RowEditEnding">
<toolkit:DataGrid.Columns>
<toolkit:DataGridTemplateColumn>
<toolkit:DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate >
<RadioButton IsChecked="{Binding Path=IsDefault, Mode=TwoWay}" GroupName="a" />
</DataTemplate>
</toolkit:DataGridTemplateColumn.CellEditingTemplate>
<toolkit:DataGridTemplateColumn.CellTemplate>
<DataTemplate >
<RadioButton IsChecked="{Binding Path=IsDefault, Mode=TwoWay}" GroupName="a" />
</DataTemplate>
</toolkit:DataGridTemplateColumn.CellTemplate>
</toolkit:DataGridTemplateColumn>
<toolkit:DataGridTextColumn Binding="{Binding TesterName}" Header="Tester Name" Width="*" MinWidth="80" />
<!-- Further columns deleted -->
</toolkit:DataGrid.Columns>
</toolkit:DataGrid>
I think what is happening is that the CellTemplate is handling the RadioButton click, so the CellEditingTemplate never gets to fire BeginEdit... Does that make sense?
If I remove the DataGridTemplateColumn.CellTemplate, I can see the BeginEdit / EndEdit being fired.
This is also being used in a MVVM pattern, so I wanted to avoid handling mouseclicks.
It seems using a RadioButton in this way would be a fairly common requirement - I must be missing something. Can anyone point me in the right direction?
Thanks, Tim
|
|
|
|
|
Try using Mode=OneWay in the CellTemplate and Mode=TwoWay in the
CellEditingTemplate
|
|
|
|
|
Has anyone been able to make a Silverlight socket policy server work with port forwarding? I really don't want to put the computer in the DMZ, ports 80/443 seem to forward but my policy server seems not to work even when the 943 port is forwarded
|
|
|
|
|
fred_ wrote: my policy server seems not to work even when the 943 port is forwarded
What about the actual connection port (4502-4534)....is that being forwarded?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
that works fine. Everything works until Silverlight makes the policy request to open a socket. On my home network works fine. Just won't work from an outside IP
|
|
|
|
|
Sorry if these questions are obvious, but I have to ask...
Does your policy server code ever get hit from outside?
If not, is there a firewall blocking port 943?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
firewall off for test nope seems to hit
|
|
|
|
|
Seems to? You should be able to run in debugger and get a hit on
a breakpoint in the policy server code.
If that succeeds, and the policy server returns a valid policy file
then a connection will be attempted on the specified connection port...
that port will need to be forwarded as well - is it being forwarded?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
thats my issue. the Silverlight ports hit, just not 943. Same setting in router forwarding ( obviously besides the port number) and no hit
|
|
|
|
|
actually I re-tested as I've been trhough many interations. The policy sever DOES hit the break point. The client Silverlight app still denies the connection to the server socket.
[edit for typo]
|
|
|
|
|
fred_ wrote: The client Silverlight app still denies the connection to the server socket.
Any exception?
The only thing I can think of is the Silverlight app doesn't like the
returned policy file - either it's malformed or it doesn't permit connections
on the port the Silverlight app is trying to connect to.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I'm trying to do DataBinding in XAML woutout any coudebehind. However I can't find any of the nice Binding features found on most other WPF controls.
What is the most current and prefered way to do databinding on RadioButtons ?
|
|
|
|
|
hhrafn wrote: I can't find any of the nice Binding features found on most other WPF controls
Which properties of the RadioButton control are you
trying to bind to that are missing "the nice Binding
features"?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
well, I'd like to use the radio buttons like this: (in theory at least)
<RadioButtons ItemsSource="{Binding Colors}" />
Then picking up the selected item through a selectedItem binding (?)
Basically my problem is that I need it to be MVVM (no codebehind) and this radio button list will also be dynamic (changeable).
|
|
|
|
|
Well, a RadioButton is not an items control, and I have never heard of a "RadioButtons" control. You might try using an ListBox to allow you to bind the ItemsSource and make a RadioButton in the ItemTemplate. The tricky part will be binding the IsChecked of the RadioButton to the IsSelected on the ListBoxItem.
|
|
|
|
|
In addition to Gideon's reply...
Why are you hung up on not using code behind? What's the difference
between code generated from the XAML and code you write? It's the
same class either way.
You could provide individual bool properties to bind the IsChecked
properties of each radiobutton to.
You could also use a converter to modify the IsChecked properties of the
radiobuttons into some other form, like an enum etc.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'm not sure if I totally understand your requirement, however you can certainly use MVVM to support a radio button list. Take a look at "Creating an Internationalized Wizard in WPF" [^], in particular the section "Presenting Options via OptionViewModel". In this example the OptionViewModel is used for CheckBox options and RadioButton options. BTW it can be extended for a Combobox - you will see my thread in the discussions for the article, and Karl's solution.
I hope this helps.
Tim
|
|
|
|
|
Thank you, this solution looks perfect for me
My main requirement in this project is to follow the MVVM pattern, or "total" seperation of View and Code (control).
Thanks again.
|
|
|
|
|
I am new to silverlight and I need to throw the data from the database into real time graph using silverlight technology, pl suggest me how can I achieve this?
|
|
|
|
|
Using WPF, while following the MVVM pattern, I'm constructing a digital version of a paper form.
This paper form has many fields that need to be filled out.
The fields are basicly boxes with the title of the field inside it, then you write the appopriate data into the box.
I was wondering if I should use a UserControl to solve this repedative taks of all these many boxes. All with different titles and data, but having basically the same look.
So I constructed a UserControl with one Label (name="Title") and a TextBox (name="Text").
Now, if I have a ViewModel as DataContext for the form window (which contains all of these UserControl-fields, how can I bind the properties of the ViewModel to the content properties of the Lable and TextBox?
I'm hoping I won't have to add any codebehind to the UserControl just to make Properties.
Is there some nifty thing I can do here?
Am I on the right path even, should I perhaps just stick to datatemplates somehow ? .. or just make one huge form with many many manu labels and textboxes ? 
|
|
|
|
|
hi to all.....
plz help me in....how to design page navigation window form using back and next button......for exmple...if we take a window like install wizard window..in that v use a button name as next.. for go through the next step...like ....sooo can u any one send me that source code...
|
|
|
|
|
hi to all.....
plz help me in....how to design page navigation window form using back and next button......for exmple...if we take a window like install wizard window..in that v use a button name as next.. for go through the next step...like ....sooo can u any one send me that source code...
@nu Gunturi
|
|
|
|
|