xaml

Binding to first N items in an ObservableCollection on a ListView

不羁岁月 提交于 2020-05-31 05:54:53
问题 I have an ObservableCollection<T> in my application that can hold numerous items. Specifically, this is summary information from a potentially extensive logger. What I'd like to do is bind strictly the top 3 items of this collection to WPF ListView . Is there XAML syntax, or a simple enough way to create a secondary property in my VM, to always return the top 3 items in the collection as well as update any changes to the collection as a normal ObservableCollection<T> would if you were

MarkupExtension is not valid for Setter.Value. The only supported MarkupExtension types are DynamicResourceExtension and BindingBase or derived types

限于喜欢 提交于 2020-05-31 05:25:31
问题 I have a custom markup extensions "ThemeExtension" to provide "SolidColorBrush" from my DefaultTheme.xaml ResourceDictionary. Calling example: BorderBrush="{extensions:Theme Key= FooKeyValue}" It is working without any problems on runtime, but SOMETIMES it starting to crash during design time and I can't develop anymore. The designer is crashed. Rebuild, Clean Solution, OS Restart is NOT helping anymore. If I change some value inside of the XAML code it is working for exactly for 1 drawing!

Making a ToolTip not visible

孤街醉人 提交于 2020-05-30 08:01:52
问题 There is an icon that I want to always be visible, but I want the tooltip to be conditionally visible. Here is the code that I currently have: <TextBlock Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" FontSize="15" Visibility="{Binding IsConnected, Converter={StaticResource BooleanToVisibilityConverter}}"> <fa:ImageAwesome Icon="{Binding Path=BatteryLevelIcon, UpdateSourceTrigger=PropertyChanged}" Height="20" Width="20" Foreground="Green" Visibility="{Binding IsConnected, Converter=

TextBox inside a ListView bound to an object, two way binding dosen't work

这一生的挚爱 提交于 2020-05-29 09:46:17
问题 Edit: Ok after finally playing around numerous times without no luck, I have created a very small Wpf application. You can directly copy this code. Notice when you change values in the TextBox and press the Test button, the values never get updated. I don't understand why the two way binding dosen't work. Please help. Here is the xaml: <Grid> <Grid.RowDefinitions> <RowDefinition Height="*"/> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> <ListView Grid.Row="0" ItemsSource="{Binding

how to use ProgressRing in a WPF application for windows

一个人想着一个人 提交于 2020-05-28 07:39:45
问题 As simple as in the title, I'd like to know how to use a ProgressRing on my gui. I can't figure out how to import the Windows.UI.Xaml.Controls namespace in which seems to be located. Thanks! Eugenio 回答1: I don't think you can add a reference to a Windows Store Apps DLL to a WPF project, they are built against different versions of the framework. You could however use a ProgressRing from a different WPF targeting DLL; MahApps Metro has one https://mahapps.com/docs/controls/progressring (source

how to use ProgressRing in a WPF application for windows

我的梦境 提交于 2020-05-28 07:39:27
问题 As simple as in the title, I'd like to know how to use a ProgressRing on my gui. I can't figure out how to import the Windows.UI.Xaml.Controls namespace in which seems to be located. Thanks! Eugenio 回答1: I don't think you can add a reference to a Windows Store Apps DLL to a WPF project, they are built against different versions of the framework. You could however use a ProgressRing from a different WPF targeting DLL; MahApps Metro has one https://mahapps.com/docs/controls/progressring (source

How to call async method from MainWindow?

有些话、适合烂在心里 提交于 2020-05-27 13:08:18
问题 So I wrote a quick async method to get some data into a DataTable from an Oracle db. How am I suppose to call this from MainWindow() without blocking UI thread? The async / wait model doesn't really make much sense there. async Task<DataTable> AccessOracleAsync() { DataTable dt; using(OracleConnection conn = new OracleConnection(ConfigurationManager.ConnectionStrings["connStr"].ConnectionString)) using (OracleCommand cmd = new OracleCommand(@"SELECT * FROM myTbl", conn)) { await conn

How to call async method from MainWindow?

血红的双手。 提交于 2020-05-27 13:07:40
问题 So I wrote a quick async method to get some data into a DataTable from an Oracle db. How am I suppose to call this from MainWindow() without blocking UI thread? The async / wait model doesn't really make much sense there. async Task<DataTable> AccessOracleAsync() { DataTable dt; using(OracleConnection conn = new OracleConnection(ConfigurationManager.ConnectionStrings["connStr"].ConnectionString)) using (OracleCommand cmd = new OracleCommand(@"SELECT * FROM myTbl", conn)) { await conn

How to call async method from MainWindow?

会有一股神秘感。 提交于 2020-05-27 13:06:28
问题 So I wrote a quick async method to get some data into a DataTable from an Oracle db. How am I suppose to call this from MainWindow() without blocking UI thread? The async / wait model doesn't really make much sense there. async Task<DataTable> AccessOracleAsync() { DataTable dt; using(OracleConnection conn = new OracleConnection(ConfigurationManager.ConnectionStrings["connStr"].ConnectionString)) using (OracleCommand cmd = new OracleCommand(@"SELECT * FROM myTbl", conn)) { await conn

VisualStateManager for UI Responsive is not working in UWP

旧巷老猫 提交于 2020-05-26 09:25:11
问题 in my uwp desktop application. I have crated one user control for header. for responsive UI i am using the VisualStateManager But its not working when i am resizing the page.i want to keep moving right hand side controls to left when i am resizing the page.this code working in some situation. I want to reduce the middle blank space size when i am resize the window. thanks in advance :) <UserControl x:Class="UWPUIResponsive.UC_Header" xmlns="http://schemas.microsoft.com/winfx/2006/xaml