|
The section which populate sthe grid is in the load events.
Please look at my earlier post to see the code events I am using.
Still having t he same problems...
|
|
|
|
|
I am working on an existing silverlight 4 application.
main page is MainPage.xaml
This page has a main datagrid i.e. datagrid1 and another datagrid i.e. datagrid2 which is inside the datagrid1.
When the application is run, the datagrid1 is populated with data.
Everytime you click on a row in datagrid1, then the datagrid2 is shown and is loaded with data.
Problems is everytime the datagrid1 is loaded, i.e. when th emainpage.xaml is run, then datagrid2 gets shown in the first row of datagrid1.
How can I stop the datagrid2 being shown when the mainpage.xaml is loaded?
I think somehow I have to get the -= and += code to work. You see them above where they are commented because they do not compile.
Any thoughts please?
for datagrid1 I am using the following events with codes inside them:
private void datagrid1_Loaded(object sender, RoutedEventArgs e)
{
//this.datagrid1.SelectionChanged -= new EventHandler(this.datagrid1_SelectionChanged);
this.DataContext = ((MainPage)(Application.Current.RootVisual)).GetData;
//this.datagrid1.SelectionChanged -= new EventHandler(this.datagrid1_SelectionChanged);
}
private void datagrid1_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (datagrid1.RowDetailsVisibilityMode == DataGridRowDetailsVisibilityMode.Collapsed && e.RemovedItems.Count == 1)
datagrid1.RowDetailsVisibilityMode = DataGridRowDetailsVisibilityMode.VisibleWhenSelected;
}
private void datagrid_RowDetailsVisibilityChanged(object sender, DataGridRowDetailsEventArgs e)
{
if (e.Row.DetailsVisibility == Visibility.Collapsed) return;
if (e.Row.DataContext is myservice.myData)
{
//retrieve data
}
}
Thanks
modified on Thursday, December 9, 2010 9:49 AM
|
|
|
|
|
I create in the code some image control and i want to set on this image control some of the picture that i saved ( load those pictures before creating the image control )
How can i do it ?
|
|
|
|
|
|
Hi,
I am unable to reload the designer for a .xaml page.
I get the error:
An unhandled Exception has occured.
System.InvalidOperationException
An unhandled exception was encountered while trying to render the current silverlight project on the design surface. To diagnose this failure, please try to run the project in a regular browser using the silverlight developer runtime.
Further down the error message it says:
System.InvalidCastException
Unable to cast object of type 'System.Windows.Controls.Canvas' to type 'myprojectname.Silverlight.MainPage'.
Any thoughts please?
Thanks
|
|
|
|
|
let us see you xaml
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Hi,
In xaml, There is an underline on {TemplateBinding Content} in the following script:
The error is: Property 'Content' was not found in type 'Control'
Do y ou see why?
Note that I can compile but not sure why I get this underline.
Any thoughts please?
Thanks
<UserControl.Resources>
...
...
...
<ControlTemplate x:Key="ToolTipTemplate">
<Border BorderBrush="red" BorderThickness="5" CornerRadius="1" Background="blue">
<ContentPresenter Grid.Column="3"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Margin="1,1,1,1"/>
</Border>
</ControlTemplate>
</UserControl.Resources>
|
|
|
|
|
This happens all the while to me. If this code works when you run it, you are good to go.
Just as a note, in Silverlight 4, the XAML parser has been upgraded and this is one of the effects of this upgrade.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
I want to reload the same page when the user clicks on the same link again.
As said in some forums I tried NavigationService.Refresh but it says Refresh is not available in NavigationService.
Iam using Sl4.
Anyhelp will be appreciated.
Thanks
Santhosh
Santhosh
|
|
|
|
|
There are a number of ways to skin this cat. I don't know if this is best practise but one of the simpler ways is to create a static property that is a pointer to the page. If null open as normal with the constructor setting the static property. If not null then call a method within the page (ie. RefreshPage) which will do the work to refresh the page as required.
|
|
|
|
|
Thanks Robert for the reply
But how do we refresh it (I mean the code)..
Santhosh
|
|
|
|
|
Well assuming the page is already displayed, by refreshing I mean applying some UI logic, displaying/hiding/enabling/disabling controls, requesting and displaying data, that sort of thing.
|
|
|
|
|
I am in th eprocess of changing a silverlight 3 application to silverlight 4.
Is it necessary to check the references in the silverlight app. so that if any refers to version 3 then change to version 4 references?
Thanks
|
|
|
|
|
arkiboys wrote: silverlight app. so that if any refers to version 3 then change to version 4 references?
Yes. Else those items will still be pointing to Silverlight 3 and your code will propably not build somewhere.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
|
You can always 'mark the answer as accepted'.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
Hi,
I am running a silverlight 4 application which is using web services.
The folowing error occurs when trying to create an instance of the web service.
Can you see why this is occuring please?
Error:
xxxServiceClient _xxClient = new xxxServiceClient();
The invocation of the constructor on type 'xx.xxx.Silverlight.xxxx.somename.somenameData' that matches the specified binding constraints threw an exception. [Line: 13 Position: 41]
Any thought please?
Thanks
|
|
|
|
|
Make sure everything is in order in the serviceRefrences.clientconfig file.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
|
Hi,
Under the target silverlight version I see silverlight 3.
How can I get silverlight 4 to appear in there as I am running vs2010 and silverlight 4 ?
Thanks
|
|
|
|
|
Hi,
I am using .net 4 visual studio 2010 premium.
I have been given a silverlight project to work on which was created in silverlight 3.
I can run the application but can not debug it.
The properties of the application shows that the target silverlight version is set to silverlight 3 and this is the only option available.
Note that I have installed silverlight 4.
And in the web.config of the host, the following line is indeed present
<compilation debug="true">
Question:
How can I debug the application based on the above please?
Thanks
|
|
|
|
|
So when you place a break point on the Code behind it does not go ?
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
All ok.
Wrong post.
Sorry
|
|
|
|
|
I want to use an expander control to contain a shadowbox style filter user control. So the basic idea is to make the expander button look like a filter button, and upon pressing a grid with some controls in it will appear in the center of the current window while the rest of the window is overlaid with a semi-transparent grid.
All the code for this is easy enough, but I am having trouble with expanded width of the expander vs. collapsed width. I want something along these lines:
<Style
x:Key="sbExpander"
TargetType="{x:Type Expander}">
<Style.Triggers>
<Trigger
Property="IsExpanded"
Value="True">
<Setter
Property="Background"
Value="Black" />
<Setter
Property="Opacity"
Value=".8" />
<Setter
Property="Width"
Value="760" />
<Setter
Property="Height"
Value="760" />
</Trigger>
</Style.Triggers>
</Style>
The expander control:
<Expander
Grid.Row="0"
Grid.Column="0"
Grid.RowSpan="10"
Grid.ColumnSpan="4"
IsExpanded="False"
HorizontalAlignment="Left"
Width="20"
ExpandDirection="Right"
Style="{StaticResource sbExpander}">
<Grid
Width="760"
Background="Black"
Opacity=".8">
</Grid>
</Expander>
The issue is that if the initial width of the expander is anything greater than 20 it overlays the rest of my controls and renders them unusable. I only want them unusable when the expander is expanded. So I really do want the collapsed expander control width to be 20 so that the controls under are available, while I want the expanded width to be 760 covering the entire window.
Thoughts?
Cheers, --EA
|
|
|
|
|
Ok, I figured it out. Put the expander inside a stackpanel whose width property was set to auto.
Cheers, --EA
|
|
|
|