Click here to Skip to main content
15,896,557 members
Home / Discussions / WPF
   

WPF

 
Questionsilverlight 4 - datagrid selectionchanged Pin
arkiboys9-Dec-10 4:45
arkiboys9-Dec-10 4:45 
AnswerRe: silverlight 4 - datagrid selectionchanged Pin
#realJSOP9-Dec-10 23:46
professional#realJSOP9-Dec-10 23:46 
GeneralRe: silverlight 4 - datagrid selectionchanged Pin
arkiboys10-Dec-10 1:26
arkiboys10-Dec-10 1:26 
AnswerRe: silverlight 4 - datagrid selectionchanged Pin
Mycroft Holmes9-Dec-10 23:54
professionalMycroft Holmes9-Dec-10 23:54 
GeneralRe: silverlight 4 - datagrid selectionchanged Pin
arkiboys10-Dec-10 1:29
arkiboys10-Dec-10 1:29 
GeneralRe: silverlight 4 - datagrid selectionchanged Pin
Mycroft Holmes10-Dec-10 12:05
professionalMycroft Holmes10-Dec-10 12:05 
GeneralRe: silverlight 4 - datagrid selectionchanged Pin
arkiboys10-Dec-10 22:26
arkiboys10-Dec-10 22:26 
Questiondatagrid issue [modified] Pin
arkiboys9-Dec-10 3:13
arkiboys9-Dec-10 3:13 
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

Questionimage control - dynamic load image from the resource file Pin
Yanshof9-Dec-10 2:27
Yanshof9-Dec-10 2:27 
AnswerRe: image control - dynamic load image from the resource file Pin
Praveen Raghuvanshi9-Dec-10 3:15
professionalPraveen Raghuvanshi9-Dec-10 3:15 
Questiondesigner .xaml error Pin
arkiboys8-Dec-10 23:43
arkiboys8-Dec-10 23:43 
AnswerRe: designer .xaml error Pin
Vimalsoft(Pty) Ltd9-Dec-10 4:19
professionalVimalsoft(Pty) Ltd9-Dec-10 4:19 
Questionerror in xaml resource Pin
arkiboys8-Dec-10 21:46
arkiboys8-Dec-10 21:46 
AnswerRe: error in xaml resource Pin
Abhinav S8-Dec-10 22:01
Abhinav S8-Dec-10 22:01 
QuestionPage Reload issue Pin
Santhosh Sebastian Mattathil8-Dec-10 21:29
Santhosh Sebastian Mattathil8-Dec-10 21:29 
AnswerRe: Page Reload issue Pin
RobCroll10-Dec-10 1:40
RobCroll10-Dec-10 1:40 
GeneralRe: Page Reload issue Pin
Santhosh Sebastian Mattathil12-Dec-10 19:05
Santhosh Sebastian Mattathil12-Dec-10 19:05 
GeneralRe: Page Reload issue Pin
RobCroll14-Dec-10 12:07
RobCroll14-Dec-10 12:07 
Questionversion 3 to 4 Pin
arkiboys8-Dec-10 21:28
arkiboys8-Dec-10 21:28 
AnswerRe: version 3 to 4 Pin
Abhinav S8-Dec-10 21:59
Abhinav S8-Dec-10 21:59 
GeneralRe: version 3 to 4 Pin
arkiboys8-Dec-10 22:02
arkiboys8-Dec-10 22:02 
GeneralRe: version 3 to 4 Pin
Abhinav S8-Dec-10 23:18
Abhinav S8-Dec-10 23:18 
Questioncalling webservice error Pin
arkiboys8-Dec-10 2:38
arkiboys8-Dec-10 2:38 
AnswerRe: calling webservice error Pin
Abhinav S8-Dec-10 19:28
Abhinav S8-Dec-10 19:28 
GeneralRe: calling webservice error Pin
arkiboys8-Dec-10 21:06
arkiboys8-Dec-10 21:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.