|
Jammer wrote: intellisense popup
Execute Devenv /ResetSkipPkgs on command prompt and try again.Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
|
|
|
|
|
Is it possible to add silverlight popup in asp.net code Dre@m is not th@t wh@t u see in sleep.Dre@m is the thing which does not allow u to sleep
|
|
|
|
|
Do you mean you want to access the popup in Silverlight?
This should be possible using Javascript code.Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
|
|
|
|
|
Why do you want to add a Silverlight popup inside the Asp.Net page?Regards - Kunal Chowdhury | Software Developer | Chennai | India | My Blog | My Tweets
|
|
|
|
|
There is list box.............
When user will click on that listbox then silverlight
popup should openDre@m is not th@t wh@t u see in sleep.Dre@m is the thing which does not allow u to sleep
|
|
|
|
|
Hi,
I'm gonna pause a Storyboard in WPF, so I've used below code :
Storyboard TheStoryboard;
public window
{
TheStoryboard = (Storyboard)this.FindResource("TheStoryboardName");
}
private void MenuItemPause_Click(object sender, RoutedEventArgs e)
{
TheStoryboard.Pause();
}
But nothing happen!
What is the right way to do that ?
Thanks.
|
|
|
|
|
I think you should get a reference to the actual storyboard that's running. What you may be getting a reference to with the code above is that storyboard class, but not the instantiation that's actually running.
In addition, I would suggest using the keyword "as" to perform the cast. Then check to see if the variable is null. The cast you currently use, if it does not work, will throw an exception. The keyword "as" simply returns null if the cast does not work. Also, look into "TryFindResource" as opposed to "FindResource". I believe it works the same way in that it will return null if the resource is not found. Again, check for null before using it. Both of these suggested changes will make your code, in general, more robust.
Let me know if this helps.
Blitz
|
|
|
|
|
Thanks,
At last I could resolve the problem.
I've written it here[^]
|
|
|
|
|
I have the following:
<dg:DataGrid Visibility="{Binding HideElement, Converter={StaticResource MyBooleanToVisibilityConverter}}"
Grid.Column="1" Cursor="Hand"
Margin="11.5,-21,16,12"
Grid.Row="0" IsEnabled="True"
AlternationCount="2"
Panel.ZIndex="1000"
Style="{DynamicResource DataGridStyle}"
AutoGenerateColumns="False"
SelectedItem="{Binding SelectedPatientDocInfoItem}"
ItemsSource="{Binding PatientDocInfoCollection}"
x:Name="DocumentSearchResultsDG"
BorderThickness="0,0,0,2">
<dg:DataGrid.Columns>
<dg:DataGridTextColumn Binding="{Binding DocumentName}" IsReadOnly="True" Width=".5*" Header="Doc Name" />
<dg:DataGridTemplateColumn IsReadOnly="False" Width=".5*" Header="Delete" Selector.IsSelected="True" >
<dg:DataGridTemplateColumn.CellTemplate >
<DataTemplate >
<Button Command="{Binding DeleteItem, ElementName=DocumentSearchResultsDG}" Panel.ZIndex="7000" Width="45.9" Height="22" >
<Image Source="..\img\delete16.png" />
</Button>
</DataTemplate>
</dg:DataGridTemplateColumn.CellTemplate>
</dg:DataGridTemplateColumn>
</dg:DataGrid.Columns>
</dg:DataGrid>
</Grid>
DeleteItem = new DelegateCommand<object>(obj =>
{
PatientDocumentRepository.Delete(PatientDocument);
PatientDocInfoCollection = new ObservableCollection<PatientDocInfo>();
PatientDocumentCollection.Foreach(x => PatientDocInfoCollection.Add(x));
});
I am following the MVVM pattern so I am trying to delete a row using the button in the DGTemplateColumn but the command is not firing when I click on the button. How do I fire the button without selecting the entire row?
|
|
|
|
|
You are trying to access a public property on the data grid called "DeleteItem". Unless you subclassed the DataGrid, that property will not exist. You probably meant to reference a public property of the Window or Page that your XAML is in.
|
|
|
|
|
Hi
I have the same problem with the button not fireing.
Hav you found a solution to this?
I am using a PresentationModel that exposes a DelegateCommand as my data context to my view. All other bindings work, and if i use a listview the button command binding works but not if im using a datagrid.
my code looks like this:
<UserControl
...
x:Name="MyUserControl"/>
...
<DataGrid AutoGenerateColumns="False" ItemsSource="{Binding MyItems}">
<DataGrid.Columns>
<DataGridColumn Header="MyColumn">
<DataGridColumn.CellTemplate>
<DataTemplate>
<Button Content="Press Me" Command="{Binding ElementName=MyUserControl, Path=DataContext.PressMeIsPressed}" />
</DataTemplate>
</DataGridColumnn.CellTemplate>
</DataGridColumn>
</DataGrid.Columns>
</DataGrid>
|
|
|
|
|
Did you mean to bind to a command in the data context, or did you mean to bind to a command that is a property of the user control?
|
|
|
|
|
Hi
I ment to bind to a public command that my PresentationModel i exposing.
The user controls datacontext is set to this PresentationModel. The binding works fine if I move the button out side the datagrid. Can't figure out why it does'nt work.
/h
|
|
|
|
|
Where the button is located (e.g., in a DataGrid) shouldn't matter. I've created buttons with bound commands inside a DataGrid before without problems. Create a small example that demonstrates the issue and post the full code here (but remember to make the example as small as possible).
|
|
|
|
|
Ok, so i have created a small project that displayes my issue, but i can't upload the whole project as zip, so i have to add all the code:
It is a normal wpf project (.NET 4, but 3.5 should work as well, just need wpf toolkit)
Also i use delegate commands fron WPF PRISM so these two assemblies are needed:
Microsoft.Practices.Composite.dll
Microsoft.Practices.Composite.Presentation.dll
MainWindow.xaml
<Window x:Class="DataGridButtonCommandTest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="300" Width="400" x:Name="MyView">
<Grid DataContext="{Binding}">
<Grid.RowDefinitions>
<RowDefinition Height="224*" />
<RowDefinition Height="45" />
</Grid.RowDefinitions>
<DataGrid AutoGenerateColumns="False" ItemsSource="{Binding Path=MyItems}" Margin="10,10,10,0" CanUserAddRows="False" CanUserDeleteRows="False" Grid.RowSpan="1">
<DataGrid.Columns>
<DataGridTemplateColumn Header="Title" Width="100">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding ItemTitle}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Header="Button" Width="100">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Content="{Binding ButtonTitle}" Command="{Binding ElementName=MyView, Path=DataContext.ShowMyPopUp}"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
<StackPanel Orientation="Horizontal" Grid.Row="1" VerticalAlignment="Bottom" Margin="10">
<TextBlock Text="Button with same command binding: " VerticalAlignment="Center" Margin="0,0,5,0"/>
<Button Content="Show popup" Command="{Binding ElementName=MyView, Path=DataContext.ShowMyPopUp}" Width="75"/>
</StackPanel>
</Grid>
</Window>
MainWindow.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace DataGridButtonCommandTest
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
this.DataContext = new PresentationModel();
}
}
}
PresentationModel.cs
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using Microsoft.Practices.Composite.Presentation.Commands;
namespace DataGridButtonCommandTest
{
public class PresentationModel : INotifyPropertyChanged
{
private ObservableCollection<MyItem> myItems;
public event PropertyChangedEventHandler PropertyChanged;
public DelegateCommand<object> ShowMyPopUp { get; private set; }
public PresentationModel()
{
MyItems = new ObservableCollection<MyItem>
{
new MyItem{ItemTitle = "First", ButtonTitle = "Show popup"},
new MyItem{ItemTitle = "Second", ButtonTitle = "Show popup"},
new MyItem{ItemTitle = "Third", ButtonTitle = "Show popup"}
};
ShowMyPopUp = new DelegateCommand<object>(OnShowMyPopUp);
}
private void OnShowMyPopUp(object obj)
{
var popUp = new PopUpWindow();
popUp.ShowDialog();
}
public ObservableCollection<MyItem> MyItems
{
get
{
return myItems;
}
set
{
if(!Equals(myItems, value))
{
myItems = value;
OnPropertyChanged("MyItems");
}
}
}
private void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}
public class MyItem
{
public string ItemTitle { get; set; }
public string ButtonTitle { get; set; }
}
}
PopUpWindow.xaml
<Window x:Class="DataGridButtonCommandTest.PopUpWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="PopUpWindow" Height="300" Width="300">
<Grid>
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="It works!!!"/>
</Grid>
</Window>
PopUpWindow.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace DataGridButtonCommandTest
{
public partial class PopUpWindow : Window
{
public PopUpWindow()
{
InitializeComponent();
}
}
} modified on Thursday, February 18, 2010 5:10 AM
|
|
|
|
|
You need to HTML encode your code when you paste it. I can't read this.
|
|
|
|
|
hehe, sorry, forgot =)
i fixed it in the previous post
|
|
|
|
|
It's still not quite right. Your observable collection appears to not have a templated type. And I'm not sure that I saw "System.Collections.ObjectModel" included (for ObservableCollection).
|
|
|
|
|
I was able to confirm your problem and I did some searching. I came across this. Basically, I think DataGrid handles scoping incorrectly, so when you say "ElementName=", the binding is not able to find anything outside of the DataGrid. To get around that, you use a relative source instead of element name:
<Button Content="Show Popup" Command="{Binding Path=DataContext.ShowMyPopUp, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" />
|
|
|
|
|
SOOOOOO NICE!!!!
it works so good! thanks for the help!
|
|
|
|
|
I still cant get this to work. I have tried every combination from posts about this subject but I am still running into the issue of it thinking I am selecting the entire row instead of firing off the button command.
PLEASE HELP!
<UserControl.Resources>
<ObjectDataProvider x:Key="Viewmodel" ObjectType="{x:Type ViewModels:DocManagementViewModel}"/>
<Utilities:ArithmeticConverter x:Key="arithConverter" />
<Utilities:BooleanToVisibilityConverter x:Key="MyBooleanToVisibilityConverter" />
</UserControl.Resources>
<Grid Margin="0,32.667,3,20" Panel.ZIndex="2296" x:Name="LayoutGrid" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto" MinWidth="18.542"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition MinHeight="300"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Margin="0,-20,7,0" >
<Grid.RowDefinitions></Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<dg:DataGrid
Visibility="{Binding HideElement, Converter={StaticResource MyBooleanToVisibilityConverter}}"
Grid.Column="1" Cursor="Hand"
Margin="15.5,-19,17,12"
Grid.Row="0"
AlternationCount="2"
Panel.ZIndex="1000"
Style="{DynamicResource DataGridStyle}"
AutoGenerateColumns="False"
SelectedItem="{Binding SelectedPatientDocInfoItem}"
ItemsSource="{Binding PatientDocInfoCollection}"
x:Name="DocumentSearchResultsDG"
BorderThickness="0">
<dg:DataGrid.Resources>
<Style TargetType="{x:Type dg:DataGridRowHeader}">
<Setter Property="Background" Value="Transparent"/>
</Style>
</dg:DataGrid.Resources>
<dg:DataGrid.Columns>
<dg:DataGridTextColumn Binding="{Binding DocumentName}" IsReadOnly="True" Width=".5*" Header="Doc Name" />
<dg:DataGridTextColumn Binding="{Binding Category}" IsReadOnly="True" Width=".5*" Header="Category" />
<dg:DataGridTextColumn Binding="{Binding CreatedDate, StringFormat=\{0:MM/dd/yyyy\}}" IsReadOnly="True" Width=".5*" Header="Scanned Date" />
<dg:DataGridTextColumn Binding="{Binding CreatedByUserId}" IsReadOnly="True" Width=".5*" Header="Scanned By" />
<dg:DataGridTextColumn Binding="{Binding Comment}" IsReadOnly="True" Width=".5*" Header="Comment" />
<dg:DataGridTemplateColumn Header="Delete" Width="100" >
<dg:DataGridTemplateColumn.CellTemplate >
<DataTemplate >
<Button HorizontalAlignment="Center" Command="{Binding Path=DataContext.DeleteItem, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}" Margin="0,1,0,0" Height="15" Width="15" Template="{DynamicResource RedGlassButton}" Style="{StaticResource CloseBtnStyle}" >
</Button>
</DataTemplate>
</dg:DataGridTemplateColumn.CellTemplate>
</dg:DataGridTemplateColumn>
</dg:DataGrid.Columns>
</dg:DataGrid>
</Grid>
</Grid>
Here is my ViewModel
<br />
public ICommand DeleteItem { get; private set; }<br />
public DocManagementViewModel()<br />
{ <br />
DeleteItem = new DelegateCommand<object>(obj => DeleteDocumentGroup());<br />
}<br />
<br />
private void DeleteDocumentGroup()<br />
{<br />
PatientDocumentRepository.Delete(PatientDocument);<br />
}<br />
|
|
|
|
|
Hi All,
I'm just implementing my first Silverlight WCF service in an ASP.NET web site hosting a Silverlight client and have run into a problem.
The service and client are working together fine, I've just done a little "Hello World" test on the two communicating. Now I'm ready to move onto the implementation and the guts of the service.
In a normal WCF setup for me I would create a separate class library project containing the service contract and any required domain objects. Then I can link to that from the service and the client and get all the same objects used at both ends of the pipe.
However, I'm running into an error:
Could not load file or assembly 'System.ServiceModel, Version=2.0.5.0
I'm assuming this is because the service and client are using two different versions of .NET. So the Core library is getting compiled in one environment and then told to run in two, fail!
Is there a work around for this?
Cheers,
|
|
|
|
|
Either use .NET 4 which allows this (in a somewhat limited way), or you need to create a separate Silverlight DLL and link your classes in as external items."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 Pete,
I tried this both ways, making a normal class library and a silverlight class library and each time either the client or the service complained about the runtime version.
|
|
|
|
|
Hi .......
I want to display popup window ............
when user click on asp.net button(register clientside
JavaScript function) in aspx page .....
then popupwindow should display with given text,
text is parameter ......................
that pass asp.net button to client JavaScript function ...
waiting your replyDre@m is not th@t wh@t u see in sleep.Dre@m is the thing which does not allow u to sleep
|
|
|
|