Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all 18858 articles
Browse latest View live

WPF InvalidOperationException Getting MainWindow Reference

$
0
0

I have MainWindow, which contains an instance of DemoUI (a UserControl).

From within a class instance called DemoModule, I have a reference to DemoUI which I call _demoUI.

When I try to get a reference to the MainWindow from within DemoModule using

var parentWindow = Window.GetWindow(_demoUI);

I get this InvalidOperationException:

The calling thread cannot access this object because a different thread owns it.

Ultimately, I want to be able to update the MainWindow's progress bar's value using it's Dispatcher as follows:

var progressBar = parentWindow.FindName("ProgressBar")asProgressBar;

progressBar.Dispatcher.Invoke(DispatcherPriority.Normal,newDispatcherOperationCallback(o =>{
        progressBar.Value=Progress= args.Current;returnnull;}),null);


Everyday this forum loses my email and I loose notifications

$
0
0

I have posted this problem here and in the forum for forum problems.  NOTHING IS BEING DONE!!!!

Is there anyone from MS who cares that this is happening or get in touch with someone that can help.  This happens about every second day.

Between the problems with the forum not even showing and the email problem, I think the last update to this forum really screwed up!!!

HELP!!!!!!!!!!!!!!!!!!!


Lloyd Sheen

Setting mediaelement volume

$
0
0

If I just set the volume in code like     mediaelementname.volume = 0.0 nothing changes.  If I replace that code with a storyboard like:

            Dim sb As New Storyboard
            Dim da As New DoubleAnimation With {.From = theMedia.Volume, .To = 0, .Duration = TimeSpan.FromMilliseconds(10)}
            Storyboard.SetTarget(da, theMedia)
            Storyboard.SetTargetProperty(da, New PropertyPath(MediaElement.VolumeProperty))
            sb.Children.Add(da)
            sb.Begin(Me, True)

That works.  Why do I have to use a storyboard to set the volume?


Lloyd Sheen

WPF 4.5 doesn’t show the option to open the project in Blend for Visual Studio 2013

$
0
0

Hi,

In my WPF 4.5 project in Visual Studio 2013, when I right clicked the name of my project it doesn’t show the option to open in Blend for Visual Studio 2013….. and when I try to open the project with Blend for Visual Studio 2013, it doesn't show anything..... I don't see the project nor the UI of my WPF 4.5 project

How I can open my project in Blend for Visual Studio 2013???

Thanks!!!

Regards,

WPF Windowless App - Weird Icon

$
0
0

Hi all,

I have a windowless app, that is effectively a silent background app. It has no footprint in the tray. However I've recently noticed that it is in fact displaying a small, circular icon, that I've never seen before. Here it is, can anyone shed any light on how I can remove this? Or just what it is!

UFO!

Regards,

Jib

Change font size of window caption(title bar) in WPF C#

Still problems with THIS forum not others

$
0
0

I am still having problems with this forum.  The filters will stay as Unanswered and there is nothing I can do to stop this.  Other forums work fine.

Perhaps if MS employees would stop moving my posts to a forum that no one goes to and FIX THIS I could stop trying to get it fixed.

Is there no one at MS that give a crap about this????


Lloyd Sheen

Loop listbox items in circular manner of Listbox

$
0
0

I have a listbox with the horizontal scroll enabled and with some 20 items. Now the listbox's width (as its horizontal scroll) is not enough to show all items together. The user will scroll it left to right or vice versa. 

I want when the user reaches either end of the listbox, the listbox should loop around. Say user reaches item 20 so instead of listbox stopping there it should automatically show item 1 and then so on.. 

Any ideas on how this can be implemented? This might not be consistent with the way listbox is designed but I need to implement this functionality.


Kavitesh Singh.

Scrolling not working in DataGrid for Tablet

$
0
0

Problem : I have an application in WPF which will run on tablet. In normal way scrolling(with finger drag in tablet) works fine in DataGrid but as soon as I applied style on this datagrid scrolling  stops in tablet. Below is xaml 

DataGrid x:Name="dgItem"
                      Margin="5"
                      AlternationCount="2"
                      AutoGenerateColumns="False"
                      IsReadOnly="True"
                      ItemsSource="{Binding ItemList}"
                      Style="{DynamicResource DGStyle}"
                      RowDetailsVisibilityMode="Collapsed"
                      ScrollViewer.PanningDeceleration="1000"
                      ScrollViewer.PanningMode="Both"
                      ScrollViewer.PanningRatio="2"
                      SelectedItem="{Binding stProduct,
                                             Mode=TwoWay,
                                             UpdateSourceTrigger=PropertyChanged}"
                      SelectionMode="Single"
                      Visibility="{Binding DataContext.stProductList,
                                           RelativeSource={RelativeSource FindAncestor,
                                                                          AncestorType={x:Type UserControl}},
                                           Converter={StaticResource ItemToVisibility},
                                           Mode=TwoWay}">


 <Style x:Key="DGStyle" TargetType="{x:Type DataGrid}">
        <Setter Property="Background" Value="#FFF" />
        <Setter Property="AlternationCount" Value="2" />
        <Setter Property="GridLinesVisibility" Value="Vertical" />
        <Setter Property="VerticalGridLinesBrush" Value="{DynamicResource GridLineBrush}" />
        <Setter Property="RowStyle" Value="{DynamicResource RowStyle}" />
        <Setter Property="Margin" Value="5" />
        <Setter Property="IsReadOnly" Value="True" />
        <Setter Property="ScrollViewer.IsEnabled"  Value="True"/>
  </Style>


<Style x:Key="RowStyle" TargetType="{x:Type DataGridRow}">
        <Style.Triggers>
            <Trigger Property="ItemsControl.AlternationIndex" Value="0">
                <Setter Property="Background" Value="Aqua" />
            </Trigger>
            <Trigger Property="ItemsControl.AlternationIndex" Value="1">
                <Setter Property="Background" Value="White" />
            </Trigger>
        </Style.Triggers>
    </Style>

how can i start unified POS software development using wpf.

$
0
0

I am going to develop unified POS system which can be install and work on all operating system 

Can anybody who have experience for WPF in POS like application tell me that what are the pros or cons....?

Is  that ok to go with WPF or should i switch to different technologies? how I can start.

Please share your reviews with me.

checkbox list...

The thread tried to read from or write to a virtual address for which it does not have the appropriate access.

$
0
0

I am experiencing a random crash in a .NET 3.5 WPF application. The crash happens around once a week.

The event log indicates its a .NET fatal execution engine error with the faulting module mscorwks.dll

Using adplus I have captured a dump file.

The dump indicates the underlying exception message was as follows

"The thread tried to read from or write to a virtual address for which it does not have the appropriate access."

I have been unable to trace the error back into my code, the call stack in the dump seems to be entirely inside the framework itself and the problem seems to happen at random times.

I'm not sure if anyone can decipher what might be happening from the call stack below. Any help is appreciated.

    mscorwks.dll!ArrayClass::GetApproxArrayElementTypeHandle()  + 0x13 bytes    
     mscorwks.dll!ArrayBase::GetArrayElementTypeHandle()  + 0x36 bytes    
     mscorwks.dll!ArrayBase::GetTypeHandle()  + 0x11 bytes    
     mscorwks.dll!Object::GetTypeHandle()  + 0x143944 bytes    
     mscorwks.dll!ObjIsInstanceOf()  + 0x2f bytes    
     mscorwks.dll!@JITutil_ChkCastAny@8()  + 0xa0 bytes    
     System.ni.dll!6face3ab()     
     [Frames below may be incorrect and/or missing, no symbols loaded for System.ni.dll]    
     System.ni.dll!6face306()     
     PresentationFramework.ni.dll!5c8f3bcf()     
     PresentationFramework.ni.dll!5c8f3ae5()     
     WindowsBase.ni.dll!5e11c366()     
     WindowsBase.ni.dll!5e1056c3()     
     PresentationFramework.ni.dll!5d240b42()     
     PresentationFramework.ni.dll!5c8686bf()     
     WindowsBase.ni.dll!5e10a31a()     
     WindowsBase.ni.dll!5e10a20a()     
     WindowsBase.ni.dll!5e108384()     
     WindowsBase.ni.dll!5e10d26d()     
     WindowsBase.ni.dll!5e10d1f8()     
     mscorlib.ni.dll!70365991()     
     mscorwks.dll!_CallDescrWorker@20()  + 0x33 bytes    
     mscorwks.dll!_CallDescrWorkerWithHandler@24()  + 0x9f bytes    
     mscorwks.dll!MethodDesc::CallDescr()  + 0x15a bytes    
     mscorwks.dll!MethodDesc::CallTargetWorker()  + 0x1f bytes    
     mscorwks.dll!MethodDescCallSite::CallWithValueTypes_RetArgSlot()  + 0x1a bytes    
     mscorwks.dll!ExecuteCodeWithGuaranteedCleanupHelper()  + 0x9f bytes    
     mscorwks.dll!ReflectionInvocation::ExecuteCodeWithGuaranteedCleanup()  + 0xfe bytes    
     mscorlib.ni.dll!70365887()     
     mscorlib.ni.dll!703504b5()     
     WindowsBase.ni.dll!5e10d133()     
     WindowsBase.ni.dll!5e107a27()     
     WindowsBase.ni.dll!5e107d13()     
     WindowsBase.ni.dll!5e10a4fe()     
     WindowsBase.ni.dll!5e10a42a()     
     WindowsBase.ni.dll!5e10a31a()     
     WindowsBase.ni.dll!5e10a20a()     
     WindowsBase.ni.dll!5e108384()     
     WindowsBase.ni.dll!5e1074e1()     
     WindowsBase.ni.dll!5e107430()     
     WindowsBase.ni.dll!5e109b6c()     
     user32.dll!_InternalCallWinProc@20()  + 0x23 bytes    
     user32.dll!_UserCallWinProcCheckWow@32()  + 0xb3 bytes    
     user32.dll!_DispatchMessageWorker@8()  + 0xe6 bytes    
     user32.dll!_DispatchMessageW@4()  + 0xf bytes    
     0012be8a()    
     WindowsBase.ni.dll!5e107b24()     
     WindowsBase.ni.dll!5e1071f9()     
     WindowsBase.ni.dll!5e10719c()     
     PresentationFramework.ni.dll!5c88f07e()     
     PresentationFramework.ni.dll!5c88e37f()     
     PresentationFramework.ni.dll!5c8756d6()     
     PresentationFramework.ni.dll!5c875699()     
     mscorwks.dll!_CallDescrWorker@20()  + 0x33 bytes    
     mscorwks.dll!_CallDescrWorkerWithHandler@24()  + 0x9f bytes    
     mscorwks.dll!MethodDesc::CallDescr()  + 0x15a bytes    
     mscorwks.dll!MethodDesc::CallTargetWorker()  + 0x1f bytes    
     mscorwks.dll!MethodDescCallSite::CallWithValueTypes_RetArgSlot()  + 0x1a bytes    
     mscorwks.dll!ClassLoader::RunMain()  - 0x38e85 bytes    
     mscorwks.dll!Assembly::ExecuteMainMethod()  + 0xa4 bytes    
     mscorwks.dll!SystemDomain::ExecuteMainMethod()  + 0x3e3 bytes    
     mscorwks.dll!ExecuteEXE()  + 0x49 bytes    
     mscorwks.dll!__CorExeMain@0()  + 0x98 bytes    
     mscoreei.dll!712af5a3()     
     mscoree.dll!_ShellShim__CorExeMain@0()  + 0x227 bytes    
     mscoree.dll!__CorExeMain_Exported@0()  + 0x8 bytes    
     kernel32.dll!@BaseThreadInitThunk@12()  + 0x12 bytes    
     ntdll.dll!___RtlUserThreadStart@8()  + 0x27 bytes    
     ntdll.dll!__RtlUserThreadStart@8()  + 0x1b bytes    

Problem With ComboBox Selection Changed Event

$
0
0

I need a code In WPF  that can bemodified text ComboBox inSelected Changeevent
to raise output., But at run time,change the text before it issent to the output. Please help me

من به کدی احتیاج دارم که بتواند متن انتخاب شده توسط کمبو باکس را در خروجی نمایش دهد . اما در هنگام استفاده از رویداد تغییر انتخاب ، متن قبل از تغییر به خروجی فرستاده میشود . لطفا کمک کنید .

TextBox Pointer

$
0
0

Hi

I have an usercontrol with three textboxes in it like

<TextBlock Text="Personnummer" Grid.Column="0" Grid.Row="0"  FontWeight="Bold"  /><TextBlock Text="Namn" Grid.Row="2" Grid.Column="0" FontWeight="Bold" /><TextBlock Text="Adress" Grid.Row="4" Grid.Column="0" FontWeight="Bold" /><TextBox Text="{Binding Personnummer}" Grid.Column="1" Grid.Row="0"/><TextBox Text="{Binding Namn}" Grid.Column="1" Grid.Row="2"/><TextBox Text="{Binding Adress}" Grid.Column="1" Grid.Row="4"/><Button Content="SUBMIT" Command="{Binding SubmitButton }" Grid.Row="4" Grid.Column="2" Margin="0,16,-1,1" Grid.RowSpan="2"/>

My customer prefers keybord before mouse so I must set first textbox "Name" ready to input as soon as my user control is loaded.

Later I must find the way to move , i quess Focus, from one TextBox to oneother by clicking Up and Down Arrow buttons on Keybord.

Any help is appreciated

RenderTargetBitmap seems to be anti-aliasing my geometry drawing

$
0
0

Using C# VS 2008 Sp1 with .NET 3.5 sp1.

When I tried to render some geometries to a bitmap, created an Image and added the bitmap as the Source finally output the Image to a file, I noticed that the line work was anti-aliased (or something equivalent). The PathGeometry objects are solid, single color lines and polygons. I absolutely must NOT have any new colors created for this imaging application.

I hope there is a way to turn off this anti-aliasing; Can anyone point me to where and why this could be happening and how I can turn it off  ? I read that text is always output anti-aliased but please tell me that is not the case for general drawing !


Styling DataGrid Select Row Button

$
0
0

When the data is populated in the cells within each row from the database a button is produced on the left hand side of the datagrid. You can use this button to select that row in the DataGrid; My question is how do you style that button that gets populated with each row of data?

Does it have to be done in the code behind or can it be done through xaml. Can some please provide an working example please thank you in advance.

How do you make coloured pixels with Visual Studios'?

$
0
0

Hi I am new to Visual Studios. I actually just heard about it a few weeks ago. I have a little experience making websites in basic HTML format. I have been trying to get into a college program to learn but the colleges need my transcripts in which I can't remember the name of school I finished up to grade 11. I only need to finish English 12 or communication 12 to graduate. I have looked in phone books online and stuff. but it seems that I'm going to have to start over from when I moved to the town I finished grade 11 in. seeing as how I cant get the transcripts I am probably going to have to start over from grade 9. which will cost me about 400 dollars to do so in which I don't have. Also I don't want to test stuff out as I don't really know what to do as when I start a new project it says a bunch of stuff in which I don't want to do anything and screw things up on my computer.

So basically I would like to know how to make basic pixel images. (in all colours) As well application to like do drop down menus, calculators, page navigation multiple page programs and such stuff like that as well as movie frames and game image frames. I know that color="000000" makes the colour black as background or font colours for HTML webpages, but I don't want to try it until I know exactly what to use in Visual Studio's. I don't now how different it is from webpages to this program, so I would like to know exactly what would make that in this program...

 


Report Viewer doesn't update with new parameters in the same session.

$
0
0

Hello every body,

I'm writing a reporting application in WPF. Firstly I created the stored procedure in SQL server to collection infos with 2 parameters (@from and @to both date type).

I create a RDLC file in the same project with threes parameters: @from,@to(date) and @chuky (I mean period type likes daily,weekly...etc). Because I had two parameters in stored procedure, so I thought I didn't need to create filter in tablix in RDLC file.

Here is load report and set parameter functions. 

 DateTime from;
 DateTime to;

            if (!(DateTime.TryParse(dpFrom.Text, out from) && DateTime.TryParse(dpTo.Text, out to)))
            {
                MessageBox.Show("Please try again !!", "Data Exception", MessageBoxButton.OK, MessageBoxImage.Stop);
                return;
            }
            Microsoft.Reporting.WinForms.ReportDataSource reportSource = new Microsoft.Reporting.WinForms.ReportDataSource();
            NhaHangDataSet dataSet = new NhaHangDataSet();
            dataSet.BeginInit();
            reportSource.Name = "DataSet1";
            reportSource.Value = dataSet.spReportMonAn;
            _reportViewer.LocalReport.ReportEmbeddedResource = "Nhahang1.Reports.ReportMonAn.rdlc";
            _reportViewer.LocalReport.DataSources.Add(reportSource);
            dataSet.EndInit();
            NhaHangDataSetTableAdapters.spReportMonAnTableAdapter adapter = new NhaHangDataSetTableAdapters.spReportMonAnTableAdapter();
            adapter.ClearBeforeFill = true;
            adapter.Fill(dataSet.spReportMonAn, from, to);
            SetParameters(_reportViewer);            
            _reportViewer.RefreshReport();        
 private void SetParameters(ReportViewer rv)
        {
            ReportParameter[] parameters = new ReportParameter[3];
            parameters[0] = new ReportParameter("from",dpFrom.Text);
            parameters[1] = new ReportParameter("to", dpTo.Text);
            parameters[2] = new ReportParameter("chuky", ((ComboBoxItem)cbbxPeriod.SelectedItem).Tag.ToString());
            rv.LocalReport.SetParameters(parameters);
        }

Everything works well.

But now is the problem. Let's see the first

and the second image.

 As you can see, with the same date condition but not the same data display.

The first image: firstly I created report with coditions are from 10-4-2014 to 10-4-2014 these conditions gave no data display, then I changed the time to (10-4-2011 to 10-4-2014) which is hoped display data, but no data displayed,it updated condition but didn't update the data.

The second image: I opened new windows and  filled the codition (10-4-2011 to 10-4-2014) at once and the data displayed in the second image.

Question: Is there any problem in my C# code. Thanks for reading.

Please help me. 


yenthuan

CompositePresentationEvent order of execution

$
0
0

If i publish multiple events in a single threaded environment, in what order will the subscribers be invoked?

for intance,

Event 1

UpdateCartEventArgs args = new UpdateCartEventArgs (param);
eventAggregator.GetEvent<UpdateCartEventArgs >().Publish(args);

Event 2

eventAggregator.GetEvent<RunTotalEvent>().Publish(
                     new RunTotalEventEventArgs(param));

In which order will the subscribers be called? Is it guarenteed (in a single threaded environment) that Event 1's subscriber will be invoked before event 2?


Anonymous

Apply Style/Trigger on Data Template

$
0
0

Hi,

I am working on Data Template in WPF where sample datatemplate:

<DataTemplate

<Border x:Name="MainBorder">

<TextBlock Text="SampleText" />

<ToggleButton x:Name="Toggle">

</ToggleButton>

</Border>

</DataTemplate>

Now, I have to apply trigger on toggle button where it should set border brush and border thickness on border.

Please help on approach.

Viewing all 18858 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>