|
I am working with a datagrid with a combobox, and it took me 3 hours to get it working, and that's only after I stumbled across an example.
So now I have this:
<DataGrid Grid.Row="1"
Grid.Column="0"
ItemsSource="{Binding JobPhases}"
SelectedItem="{Binding SelectedJobPhase}"
SelectionMode="Single"
SelectionUnit="Cell"
CanUserAddRows="False"
CanUserReorderColumns="False"
CanUserResizeColumns="True"
CanUserResizeRows="False"
CanUserSortColumns="True"
AutoGenerateColumns="False"
AlternatingRowBackground="Gainsboro"
IsSynchronizedWithCurrentItem="True"
AlternationCount="2"
FontSize="12"
IsReadOnly="False"
FontWeight="Normal"
FontStyle="Normal">
<DataGrid.Columns>
<DataGridComboBoxColumn Header="Phase Type"
SelectedItemBinding="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.SelectedJobPhaseType}"
DisplayMemberPath="Caption"
Width="150">
<DataGridComboBoxColumn.EditingElementStyle>
<Style TargetType="{x:Type ComboBox}">
<Setter Property="ItemsSource" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.JobPhaseTypes}"/>
<Setter Property="IsReadOnly" Value="True"/>
<Setter Property="StaysOpenOnEdit" Value="True" />
</Style>
</DataGridComboBoxColumn.EditingElementStyle>
<DataGridComboBoxColumn.ElementStyle>
<Style TargetType="{x:Type ComboBox}">
<Setter Property="ItemsSource" Value="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.JobPhaseTypes}"/>
</Style>
</DataGridComboBoxColumn.ElementStyle>
</DataGridComboBoxColumn>
</DataGrid.Columns>
</DataGrid>
The question I have is - can someone explain the syntax in the binding part?
What does 'RelativeSource' mean, and 'FindAncestor' and 'AncestorType'??
Many thanks!
If it's not broken, fix it until it is
|
|
|
|
|
I know this does not answer you question but it bears out our design decision to use dialogs. 3 hours faffing around trying to get a combo to work within a grid, 30 minutes to build a dialog, pop it and manage it. Hardest thing was finding a snippet to handle the double click on a grid which we did 3 years ago.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Actually, I agree with you. I normally use a dialog, but my client wants row editing.
If it's not broken, fix it until it is
|
|
|
|
|
Kevin Marois wrote: my client wants row editing
Bummer having to allow the client that level of say in the app design. Sorry I can't help.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
They pay the bills so they get what they want
If it's not broken, fix it until it is
|
|
|
|
|
|
Nice explanation. Thank you
If it's not broken, fix it until it is
|
|
|
|
|
I'm using MVVM...
I have been Googling this for a few hours, and I can't seem to find an example of how to set the focus to a cell and place it in edit mode.
When the user clicks the New button, I add a new object to the collection, and the row appears in the grid. However, I have to click twice in the first cell to enter edit mode.
Is there a way to do this from within the ViewModel? Or maybe a XAML based approach>
Thanks
If it's not broken, fix it until it is
|
|
|
|
|
Using a grid as a data entry tool bleh!
We use telerik and they have an edit on focus attribute, getting t it pragmatically probably involve walking the visual tree!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
I have three image buttons close,minimize and maximize .The functionalities works fine as per the standard . Now my problem is when the current window is fully fixed to our screen window then the restore button image has to be visible not maximize button. In my screen in both the normal and fixed window only maximize button is highlighting , I want to restore image button when the window is fully fixed to screen.
|
|
|
|
|
You don't say if you are using MVVM or not so I can't be more specific. However, you want the content property of the maximize/restore button. Assigning that property to the two different images will change what is shown. It is a dependency property so you could bind it to a property on a viewmodel if you are using MVVM.
The window itself has a WindowsState property which indicates what the current window state is, minimized, normal, maximized. You can inspect that property to determine what state the window is in and set the button content appropriately. I think the window state property is a dependency property in WPF too so you should be able to bind it to a property on a ViewModel and set the button content within the property setter. If not, (and I could be wrong about it being a DP) you would hook the Resize event on the window and deal with it there.
HTH!
|
|
|
|
|
Hi,
I have one XAML file window in that i have added two stack panel Stkpanel1 and StkPanel2. And I have added the content in both the panels . Now I want to add the sliding panel in StkPanel1. I need StkPaanel2 should be fully covered in the window and small symbol should be there when we click on it the stkPanel1 should be open and show its content.
It should be just like Visual studio where we can click on the solution explorer it will be visible or else it it will close and bind in the corner.
Thanks in advance . Your replies will be more helpful for me.
|
|
|
|
|
You are telling us what you have and what you want, you are not asking a question. Do some research to find the best methods of achieving what you want then try them. Ask questions when you come up agaist something we can help with.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
If you want to mimic the behavior in Visual Studio, you will need a third-party library that has a dock panel control and a dock container control. I think Sync Fusion and Telerik both have these in their WPF and SL toolkits.
Alternately, you could put both stack panels inside of a splitter. Then manage the split and the visual representations in code. The user would not be able to rearrange the panels in this case like they could with the dock panels but you would be able to "hide" either panel to it's respective side.
HTH!
|
|
|
|
|
I make Silverlight application and i want to use silverlight application from Android devices so what is the Procedure for that.
how i connect Silverlight and Android?
|
|
|
|
|
SwapnilSinnar wrote: how i connect Silverlight and Android
AFAIK you don't.
There is no unified platform/development tool across the various OS flavours.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Xamarian's tools will get you as close to it as you can get. As Mycroft mentions, there is no cross-platform toolset.
Xamarian and Marmalade are both cross-platform mobile toolkits but they implement their own API. Xamarian is based on Mono which is a Linux version of the .Net framework. The nice thing there is you are working in C# even through you are using the Xamarian API's. Maramalade is the same in that you use their tools and they cross-compile for the different platforms. Marmalade I think has the edge on the number of supported platforms right now.
On the upside, any web services you wrote for your app can be consumed on either of these platforms!
HTH!
|
|
|
|
|
Im working on a EPG (Electronic Program Guide) were I need channels to be shown verticaly, and the programs of each channel horizontaly. It's basicly a Vertical ItemsControl containing Horizontal ItemsControls witch displays labels of different sizes. It looks something like this:
http://img401.imageshack.us/img401/1623/epgtimeline.png[^]
Im virtualizing the vertical list so that only 10 channels are created but with 500 programs (labels) on each channel gives me a total of 5000 - witch is way to many - I need to virtulaze the horizontal view to!
The problem I have is that the scrollviewer won't accept the offset that I set, it's beeing modefied (OnScrollChanged beeing called 2-3 times with small adjustments). I found a workaround by using BringIntoView instead, witch for some reason work. But I need to syncronize the scrollviewer with all 10 channels, and then I need to use SetHorizontalOffset again. Note that I use Pixel scrolling and that this behavior dosent exist using ordenary StackPanel.
What I'm wondering is if someone knows why the scroll of a virtulazingstackpanel is beeing changed, or if it's possible to only use one horizontal scroll for all (viewable) channels.
I'm open for any suggestions, this issue has bothering me for over a week now.
btw, the code looks like so (each Channel has a collection of Programs):
<ItemsControl Name="lwChannels"
ItemsSource="{Binding ElementName=userControl, Path=Channels}"
FocusVisualStyle="{x:Null}"
ScrollViewer.CanContentScroll="True"
VirtualizingPanel.IsVirtualizing="True">
<ItemsControl.Template>
<ControlTemplate>
<UI:ScrollviewerX HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Hidden">
<ItemsPresenter />
</UI:ScrollviewerX>
</ControlTemplate>
</ItemsControl.Template>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel Orientation="Vertical" IsItemsHost="True" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<!--
<ItemsControl ItemsSource="{Binding Programs}"
Height="{Binding ElementName=userControl, Path=RowHeight}"
ScrollViewer.CanContentScroll="True"
VirtualizingPanel.IsVirtualizing="True"
VirtualizingPanel.ScrollUnit="Pixel">
<ItemsControl.Template>
<ControlTemplate>
<UI:ScrollviewerX HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Disabled"
PreviewKeyDown="OnScrollViewerPreviewKeyDown"
ScrollChanged="ScrollviewerX_ScrollChanged" >
<ItemsPresenter />
</UI:ScrollviewerX>
</ControlTemplate>
</ItemsControl.Template>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel Orientation="Horizontal" IsItemsHost="True"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<!--
<Label Content="{Binding Path=Title}"
BorderThickness="2"
MouseDown="OnProgramMouseDown"
Initialized="OnProgramInitialized"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
|
|
|
|
|
Sollie, unfortunately I don't think this is going to go well for you. The advert would be considered as spam, and as you haven't provided a corporate email address, it's hard to see how anyone will take this offer seriously.
|
|
|
|
|
I have a code in wpf
<inkcanvas name="inkCanvas" background="LightYellow" editingmode="Ink">>
I want to confine mouse cursor to this inkcanvas on loading the file
Any. Help
|
|
|
|
|
HI,
I had a requirement that pins in Map can be dragged and dropped into another form . But when iam trying to drag and pin from Map Drag Start and Drag Stop events are not getting fired where as for another C1datagrid forms it works . Can any one show a solution how to fire events for a MapControl.
I kept the below in pinimage leftKeyDown Event.
Private mDragDrop As C1.Silverlight.C1DragDropManager
Public WriteOnly Property DragDrop As C1.Silverlight.C1DragDropManager
Set(ByVal value As C1.Silverlight.C1DragDropManager)
mDragDrop = value
AddHandler mDragDrop.DragStart, AddressOf DragDrop_DragStart
End Set
End Property
mDragDrop.ClearSources()
mDragDrop.SourceMarker.Background = New SolidColorBrush(Colors.Transparent)
mDragDrop.SourceMarker.Height = 50
mDragDrop.SourceMarker.Width = 250
mDragDrop.SourceMarker.BorderThickness = New Thickness(0)
Dim RowPresenter As New C1.Silverlight.DataGrid.DataGridRowPresenter
If RowPresenter IsNot Nothing Then
RowPresenter.DataContext = sender.datacontext
mDragDrop.RegisterDragSource(RowPresenter, DragDropEffect.Copy, Nothing)
End If
if iam trying to drag a pin from Map, the Events in Gantt form "DragDrop_DragStart" & "DragDrop__DragOver" are not getting fired.
and Map is moving instead of pin Can you show me solution how i can drag and Drop pin and where i need to keep that code to drag pin.
Is this Drag and Drop supports for Maps ?
|
|
|
|
|
Hi All
I want display the maximum windows appears top of taskbar .
i do:
WindowState="Maximized"
But I do not know how to appear window top of the taskbar in wpf!
I'm grateful for your guidance
|
|
|
|
|
Do some research into "Kiosk" applications.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
A combination of WindowStyle="None" and WindowState="Maximized" will give you a full-screen application. However, your window won't have a title-bar, so it won't have the restore, minimize or close buttons. You'll need to provide some other way for the user to close the application.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi Team,
Below i faces issues in String using RichText box control
for example :
Hi Welcome website like www.google.com and visit this site lot of things
when i bind this strings in our RichText box control , unable show mid word like hyberlink (www.google.com)
please give your suggestion and needful
thanks
senthil
|
|
|
|